specify array length c# code example
Example 1: c# length of array
// declares a 1D Array of string.
string[] weekDays;
// allocating memory for days.
weekDays = new string[] {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
// Display length of array.
Console.Write(weekDays.Length);
Example 2: length of arr c#
string[] arr = {"foo", "bar"}
Console.WriteLine(arr.Length);
// >> 2