Array.GetLength()
using System;
class MainClass
{
public static void Main()
{
string[,] names = {
{"J", "M", "P"},
{"S", "E", "S"},
{"C", "A", "W"},
{"G", "P", "J"},
};
int numberOfRows = names.GetLength(0);
int numberOfColumns = names.GetLength(1);
Console.WriteLine("Number of rows = " + numberOfRows);
Console.WriteLine("Number of columns = " + numberOfColumns);
}
}
Related examples in the same category