I’ve tried using this method to increase the size of my class array by 1 unit:
ClassArray = new ClassVars[ClassArray+1];
But this method clearly removes all the content of the class array and re-creates with the given size which is “ClassArray+1” in this case.
So how do I increase the size of my class array without removing the existing content of the current array?
Thanks in advance,
You could use a generic list.
You can use System.Array.Resize, but if you’re going to be adding/removing from the array, you’d be better off with a generic List in most cases.
If there isn’t a specific method to do that you could make a new array that is the same size as your current array, then store all of your values in that new temp array, increase your array by however much you want (not having to worry about the values because they are being held in another array) then assign the values to that new sized array.