Array: GetLowerBound, GetUpperBound : Array Bound « Data Structure « C# / CSharp Tutorial






using System;

public class ArrayTest {

    public static void Main( ) {
       int[] array_1 = new int[5];
      
       for( int i = array_1.GetLowerBound(0); i <= array_1.GetUpperBound(0); i++)
          array_1[i] = i+1;

       for( int j = array_1.GetLowerBound(0); j <= array_1.GetUpperBound(0); j++)
          Console.WriteLine("array_1[{0}] = {1}", j, array_1[j]);

    }
}
array_1[0] = 1
array_1[1] = 2
array_1[2] = 3
array_1[3] = 4
array_1[4] = 5








11.5.Array Bound
11.5.1.Get lowerbound and upperbound
11.5.2.Array: GetLowerBound, GetUpperBound