C# 2d array help

Started by
1 comment, last by MutantSquid 14 years ago
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?
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.
"Game Programming" in an of itself does not exist. We learn to program and then use that knowledge to make games.
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.

This topic is closed to new replies.

Advertisement