Dynamic grow/shrink Array in C#
Posted on 2007-03-27
How do I dynamically grow/shrink an array of objects I have created?
I see that I can create an array like this:
VShape_c m_vShapes = new VShape_c;
but I would prefer to start with ZERO in the array, and add VShape_c objects to the array as and when i want to, so that i can also query it at any time to know how many is in the collection. Currently, I have to allocate 1000 and then I maintain a member variable that tracks how many objects I REALLY have added.
There must be a better way. Can you help?