Jump to content
  • Advertisement
Sign in to follow this  
MutantSquid

C# 2d array help

This topic is 3079 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

Hello, I'm learning C# and getting a lot of errors whenever I try using 2d arrays. I just want to create an array of values and store that array into a larger array. I need it to be dynamic so I can keep adding smaller arrays into that larger array. Here is the MSDN link. http://msdn.microsoft.com/en-us/library/aa288453%28VS.71%29.aspx I also see there are no push or splice methods. Is there a better system I should be using here instead of arrays?

Share this post


Link to post
Share on other sites
Advertisement
Yes, indeed. I would strongly suggest using a generic list instead.

You can even nest them like you're saying, so you could do:

List< List<object> > listOfObjectLists = new List< List<object> >();

You'll find Add, Remove, and all sorts of other helpful methods there.

Share this post


Link to post
Share on other sites
Quote:
Original post by Instruo
Yes, indeed. I would strongly suggest using a generic list instead.

You can even nest them like you're saying, so you could do:

List< List<object> > listOfObjectLists = new List< List<object> >();

You'll find Add, Remove, and all sorts of other helpful methods there.


Awesome. Thank you sir.

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!