Get lowerbound and upperbound
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] );
}
}
}
}
Output 1
2
3
4
5
6
7
8
9
|
HTML code for linking to this page:
Related in same category :
-
|
|