Let’s say our three-dimensional array is −
int[,,] arr = new int[3,4,5];
To get the height and width i.e. the rows and columns.
Array.GetLength(0) – for rows Array.GetLength(1) – for columns
Example
using System;
class Program {
static void Main() {
int[,,] arr = new int[3,4,5];
Console.WriteLine(arr.GetLength(0));
Console.WriteLine(arr.GetLength(1));
Console.WriteLine(arr.GetLength(2));
}
}Output
3 4 5