The argument to GetLength determines the size. The method returns the number of elements in the specified dimension. Example with a two-dimensional array:
class Program { static void Main() { var a = new int[5, 4]; Console.WriteLine(a.GetLength(0)); Console.WriteLine(a.GetLength(1)); } }
prints 5 and 4 on the screen.
source share