System.Array.GetLowerBound Method

Gets the index of the first element of the specified dimension in the array.

Syntax

[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)]
public int GetLowerBound (int dimension)

Parameters

dimension
A zero-based dimension of the array whose starting index needs to be determined.

Returns

The index of the first element of the specified dimension in the array.

Exceptions

TypeReason
IndexOutOfRangeException

dimension < 0.

-or-

dimension is equal to or greater than the Array.Rank property of the current instance.

Remarks

GetLowerBound(0) returns the starting index of the first dimension of the array, and GetLowerBound(Rank - 1) returns the starting index of the last dimension of the array.

The Array.GetLowerBound(int) method always returns a value that indicates the index of the lower bound of the array, even if the array is empty.

Note that, although most arrays in the .NET Framework are zero-based (that is, the Array.GetLowerBound(int) method returns zero for each dimension of an array), the .NET Framework does support arrays that are not zero-based. Such arrays can be created with the Array.CreateInstance(Type, Int32[], Int32[]) method, and can also be returned from unmanaged code.

This method is an O(1) operation.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0