
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get 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