static void Main()
// Initialize an array with 5 elements.char arr = new char;
arr = 'p';
arr = 'y';
arr = 't';
arr = 'h';
arr = 'o';
// We need an array with 6 elements.// ... Use Array.Resize to make a new array.Array.Resize<char>(ref arr, 6);
// Assign the last element.
arr = 'n';
// Display the array.
Notes, internals. A call to Array.Resize runs through an algorithm that determines that the array needs to be larger or smaller. It copies the array, and then changes the reference.
So Array.Resize does not resize the array. It replaces the array with a new one of a different size.
Performance. Copying an array completely when resizing it is wasteful in many situations. For these cases, use List—call Add() to add to empty space on the end.