change length of array c# code example
Example 1: C# extend array
string[] items = new string[3] { "input1", "input2", "input3" };
string[] moreItems = new string[10] { "input4", "input5" };
List<string> itemsList = items.ToList<string>();
itemsList.Add("newItem");
itemsList.AddRange(moreItems);
string[] newArray = itemsList.ToArray();
Example 2: use length to resize an array
let array = [11, 12, 13, 14, 15];
console.log(array.length);
array.length = 3;
console.log(array.length);
console.log(array);
array.length = 0;
console.log(array.length);
console.log(array);