Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Get the width and height of a three-dimensional array
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
Advertisements
