In C# I usually create new array and Copy / AddRange elements from old one.
If array is too big possible better would be to use ArrayList, which allows
to add/ remove elements dynamically.
In C# I usually create new array and Copy / AddRange elements from old one.
If array is too big possible better would be to use ArrayList, which allows
to add/ remove elements dynamically.
ArrayList does exactly the same thing under the covers, of course. It
just doesn't do it on every change - it has an array which is bigger
than needed (usually) and which gets filled until it can no longer hold
everything required, at which point the creation/copy takes place.