
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 bounds of a C# three-dimensional array
To get the bounds of a three-dimensional array, use the GetUpperBound() GetLowerBound() methods in C#.
The parameter to be set under these methods is the dimensions i.e.
Let’s say our array is −
int[,,] arr = new int[3,4,5];
For a three-dimensional arrays, dimension 0.
arr.GetUpperBound(0) arr.GetLowerBound(0)
For a three-dimensional arrays, dimension 1.
arr.GetUpperBound(1) arr.GetLowerBound(1)
For a three-dimensional arrays, dimension 2.
arr.GetUpperBound(2) arr.GetLowerBound(2)
Let us see the entire example.
Example
using System; class Program { static void Main() { int[,,] arr = new int[3,4,5]; Console.WriteLine("Dimension 0 Upper Bound: {0}",arr.GetUpperBound(0).ToString()); Console.WriteLine("Dimension 0 Lower Bound: {0}",arr.GetLowerBound(0).ToString()); Console.WriteLine("Dimension 1 Upper Bound: {0}",arr.GetUpperBound(1).ToString()); Console.WriteLine("Dimension 1 Lower Bound: {0}",arr.GetLowerBound(1).ToString()); Console.WriteLine("Dimension 2 Upper Bound: {0}",arr.GetUpperBound(2).ToString()); Console.WriteLine("Dimension 2 Lower Bound: {0}",arr.GetLowerBound(2).ToString()); } }
Output
Dimension 0 Upper Bound: 2 Dimension 0 Lower Bound: 0 Dimension 1 Upper Bound: 3 Dimension 1 Lower Bound: 0 Dimension 2 Upper Bound: 4 Dimension 2 Lower Bound: 0
- Related Questions & Answers
- Get rank of a three-dimensional array in C#
- Get Upperbound and Lowerbound of a three-dimensional array in C#
- Size of a Three-dimensional array in C#
- Get the width and height of a three-dimensional array
- Accessing array out of bounds in C/C++
- How to find the mean of three-dimensional array in R?
- Get the Inner product of a One-Dimensional and a Two-Dimensional array in Python
- Return a new Three-Dimensional array without initializing entries in Numpy
- Get the inverse of a Four-Dimensional array in Python
- Dimensional Array in C#?
- What is out of bounds index in an array - C language?
- 4 Dimensional Array in C/C++
- Transpose of a two-dimensional array - JavaScript
- Passing two dimensional array to a C++ function
- Return a new Three-Dimensional array without initializing entries and change the order in Numpy
Advertisements