get length of array c sharp 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: how to get an arrays length in c#
int array[] array;
int index;
public void func(){
for(int i; i < array.Length;i++){
index++;
}
Console.Write(index);
}