Click to See Complete Forum and Search --> : How can I dynamically increase an array in C#


ser
January 30th, 2005, 06:44 PM
or delete a part of it, similar to C++: CArray.Add()/RemoveAt().
Through ArrayList and using Buffer.BlockCopy I can double it but what about removing a part of it.

ser
January 30th, 2005, 07:29 PM
sorry, I think I've found a solution. Queue method looks like exceeding my requirements.

boudino
January 31st, 2005, 02:04 AM
What is wrong about ArrayList? I think it is the right class for you. Or do you want the array to physicaly cut allocated memory if removing elements? This is not good demand. If memory is already allocated to the array, it cost nothing to keep it allocated event empty. Shrinking the allocated memory is unnecessary overhead, because, the managed memory has to be reorganized.