Can anyone show me an example on how to create a two dimensional ArrayList?
Printable View
Can anyone show me an example on how to create a two dimensional ArrayList?
There is no two dimensional array list. Depending on what you need, you can use a two dimensional array, an arraylist of arraylists or an arraylist of points. Maybe a SortedList would do. ( Hint: SortedList in .NET is not a sorted list. :mad: )
This is how to create one:
d1 is the length of the first dimension. At this point the variable arrayList is an ArrayList that has other ArrayLists as items. This is kind of pointless in my opinion, but it should work.Code:ArrayList arrayList = new ArrayList();
for (int i = 0; i < d1 ; i++)
{
ArrayList l2 = new ArrayList();}
arrayList.Add(l2);
LT
Thanks guys! turns out I dont need to use it anymore, so thanks anyways!