C# – Changing the Length of an Array
We continue with array. This time how we change the length of an array.
Arrays are immutable = cannot be changed in memory. However .Net Framework providers helper methods to resize an array… creates a new array and copies the old values into it.
Array.Resize(ref myArray, myArray.Length + 1);
//Get the highest index:
int highestIndex = myArray.GetUpperBound(0);
// 0 = dimension we want to retrieve the upper boundary for
//Arrays have other helper methods
myArray.Sum(); myArray.Min(); myArray.Max(); myArray.Average(); Array.Sort(myArray); Array.Reverse(myArray);