Is there any way to declare an array without initially declaring the size? I am trying to use a 2 dimentional array that can add elements during user interaction and keep the existing elements in tact. I also need to be able to access the last element in the array, which is why I cant declare a size.
int [][] array = new int [5][];
for loop.....
array[0][new index].Add(element);
for loop....
array[1][new index].Add(element);
I need to be able to access the last index in this array which is unknown, but I cant add new elements unless the size is declared. Can anyone help? I am not very experienced with C#, and cannot find the conversion from VB to fix this. Thanks to anyone who can help.
int [][] array = new int [5][];
for loop.....
array[0][new index].Add(element);
for loop....
array[1][new index].Add(element);
I need to be able to access the last index in this array which is unknown, but I cant add new elements unless the size is declared. Can anyone help? I am not very experienced with C#, and cannot find the conversion from VB to fix this. Thanks to anyone who can help.