Jump to content
  • Advertisement
Sign in to follow this  
Calin

Some C# questions

This topic is 4468 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 started using C# and DirectX for a project. The first question is how do you organize your code in a C# project. The C++ logic doesn't work. You can't write the definition of a function outside the class, this makes the class quite messy after a while. Are there some unwritten rules to follow like those from C++ projects? My second question is about STL containers, I know you could use them in a C# application by adding a #pragma unmanaged statement, however I would like to ask if C# has some native containers similar to STL containers. My last question is if I start using C++ STL containers would it be possible to store Managed DirectX resources (i.e. meshes, textures) in them? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
.NET container classes are called 'collections'. In .NET 2.0, List<T> and Dictionary<K,V> are the most similar to the STL containers.

Share this post


Link to post
Share on other sites
I don't know. I don't read much of others' code, and don't have real life coders to banter such stuff with.

Personally, I like grouping all of the delegate definitions/enum declarations near the top, followed by data, followed by functions [grouped by similarity, in #regions for larger structures]. It's likely one of those things where there's a few different preferences, and the key is that you pick one and use it consistantly.

Share this post


Link to post
Share on other sites
Quote:
Original post by Calin
Thanks again!


If you feel your class is too messy, you might want to look into partial classes.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!