Last Updated : 11 Jul, 2025
GetLowerBound() Methodis used to find the index of the first element of the specified dimension in the array.
Syntax:public int GetLowerBound (int dimension);
Here,
dimensionis a zero-based dimension of the array whose lower bound needs to be determined.
Return Value:The return type of this method is
System.Int32. This method returns the index of the first element of the specified dimension in the array.
Exception:This method will give
IndexOutOfRangeExceptionif the value of
dimensionis less than zero, or equal or greater than
Rank.
Note:Below programs illustrate the use of
GetLowerBound() Method:
Example 1: CSharp
// C# program to illustrate the GetLowerBound(Int32)
// method in 1-D array
using System;
public class GFG {
// Main method
static public void Main()
{
// 1-D Array
int[] value = {1, 2, 3, 4, 5, 6, 7};
// Get the index of the first element
// in the given Array by using
// GetLowerBound(Int32) method
int myvalue = value.GetLowerBound(0);
Console.WriteLine("Index: {0}", myvalue);
}
}
Example 2: CSharp
// C# program to illustrate the GetLowerBound(Int32)
// method when the array is empty
using System;
public class GFG {
// Main method
static public void Main()
{
// Empty 1-D Array
int[] value = {};
// Get the index of the first element
// in the given Array by using
// GetLowerBound(Int32) method
int myvalue = value.GetLowerBound(0);
Console.WriteLine("Index: {0}", myvalue);
}
}
Reference: https://learn.microsoft.com/en-us/dotnet/api/system.array.getlowerbound?view=netcore-2.1
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4