# 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

Live Demo

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