Mohan said:
In my application, I need to increase the 2-dimensional array size
dynamically.
Please let me know the procedure to declare a dynamic 2-dimensional array
like Single dimensional array, ArrayList.
An ArrayList, which can be dynamically increased in size, is not an
array. It's not possible to increase arrays in size dynamically,
regardless of the number of their dimensions.
Of course you could use an ArrayList of ArrayLists:
ArrayList outerList = new ArrayList();
outerList.Add(new ArrayList());
outerList.Add(new ArrayList());
Now you can access outerList[0] and outerList[1] and add arbitrary
numbers of objects to them, or you can extend outerList. So the complete
construction is effectively dynamically resizable in two dimensions.
Depending on the needs of your data storage, you should definitely look
at other solutions, though - it would be better to use typed
collections, for example, and although there are points where a solution
like this is required, I wonder if a more tightly integrated data
management class wouldn't be a better solution.
Oliver Sturm