Jump to content
  • Advertisement
Sign in to follow this  

C# - store a "reference" of an object : performance killer?

This topic is 2212 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I've been programming in C# for a long time & one thing I'd love to have there (optionally) are pointers.

I've been developing a game project for several years, & I usually declare attributes in my classes in order to store other handy objects.
For example, I've created a custom ModelMesh in which I store it's parent (container) Model:

class ExtendedModelMesh()
-Model theModelWhoContainsMe;

I do this for example to be able to access easy & quickly to the model's position, rotation, scale attributes & some other things.

My question is: Is it a performance killer? (in this particular case I store the same model along all it's meshes (imagine 150 meshes per model).
Is it not only eating a lot of memory but also slowing down things when fetching up the model?

Thanks a lot,


Share this post

Link to post
Share on other sites
In C#, your object is stored by reference. This is effectively the same as storing by pointer, in an abstract sense.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!