C# Array GetLowerBound() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Array

Definition

In C#, GetLowerBound(dimension) returns the smallest valid index for that dimension. For ordinary arrays created with new T[n], the lower bound is 0.

Some arrays created with Array.CreateInstance can start at a non-zero lower bound. Knowing lower and upper bounds keeps loops correct for those rare cases.

This is an instance member of System.Array. You call it on an array variable with a dot, such as arr.GetLowerBound(...). Arrays in C# have a fixed length after creation; use List<T> when the count must grow.

Syntax

Call GetLowerBound with the dimension index.

C#
int start = nums.GetLowerBound(0);
CallWhat it does
nums.GetLowerBound(0)Usually 0 for normal 1D arrays.
grid.GetLowerBound(1)Lower bound of dimension 1.

Pair with GetUpperBound when looping non-zero-bound arrays.

Library declarations
C#
public int GetLowerBound(int dimension);

Parameters

ParameterDescription
dimensionRequired. 0-based dimension index.

Return Value

Return ValueDescription
intFirst valid index for that dimension.

C# Examples

Example 1 — Lower Bound Is Zero

Show the common case for a normal array.

C#
using System;

class Program {
    static void Main() {
        int[] nums = { 1, 2, 3 };
        Console.WriteLine(nums.GetLowerBound(0));
        Console.WriteLine(nums.GetUpperBound(0));
    }
}

How It Works

  1. Starts at 0. First index is 0.
  2. Upper is 2. Last index for length 3.
  3. Typical arrays. new T[n] always uses 0.
  4. Loop style. for (i = 0; i < Length; i++) works.

Example 2 — Custom Lower Bound

CreateInstance with lower bound 5; indexes start at 5.

C#
using System;

class Program {
    static void Main() {
        Array arr = Array.CreateInstance(typeof(int), new int[] { 3 }, new int[] { 5 });
        Console.WriteLine("Lower: " + arr.GetLowerBound(0));
        Console.WriteLine("Upper: " + arr.GetUpperBound(0));
        arr.SetValue(42, 5);
        Console.WriteLine(arr.GetValue(5));
    }
}

How It Works

  1. CreateInstance overload. Lengths and lower bounds arrays.
  2. Lower 5. First valid index is 5, not 0.
  3. Upper 7. Three slots: 5, 6, 7.
  4. SetValue(42, 5). Writes the first slot.

Example 3 — Lower Bounds per Dimension

Both dimensions of a normal matrix start at 0.

C#
using System;

class Program {
    static void Main() {
        int[,] grid = new int[2, 2];
        Console.WriteLine(grid.GetLowerBound(0) + "," + grid.GetLowerBound(1));
      }
}

How It Works

  1. Two zeros. Both dimensions start at 0.
  2. Normal new. Rectangular arrays from new use zero bounds.
  3. Still query. Library code may call GetLowerBound defensively.
  4. Upper next. See GetUpperBound for last indexes.

Frequently Asked Questions

The first valid index in a dimension. Usually 0.
Yes, when created with certain CreateInstance overloads, but it is uncommon.
Use GetUpperBound for that dimension.
Length is the count of elements, not the upper index + 1 when lower bound is non-zero.
Rarely. Know the API exists if you handle arbitrary Array instances.

Next: GetUpperBound()

Return the last valid index of a dimension with System.Array.

GetUpperBound() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful