C# 2d array help
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?
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.
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.
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
Popular Topics
Advertisement