Get lowerbound and upperbound : Array Bound « Data Structure « C# / CSharp Tutorial






using System;

public class MainClass
{
    static void Main() {
        int[,] twoDim = { {1, 2, 3},
                          {4, 5, 6},
                          {7, 8, 9} };

        for( int i = twoDim.GetLowerBound(0);
             i <= twoDim.GetUpperBound(0);
             ++i ) {
            for( int j = twoDim.GetLowerBound(1);
                 j <= twoDim.GetUpperBound(1);
                 ++j ) {
                Console.WriteLine( twoDim[i,j] );
            }
        }
    }
}
1
2
3
4
5
6
7
8
9








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