Array lowerbound and upperbound
In this chapter you will learn:
Get lowerbound and upperbound
using System;/*from j av a 2 s . co m*/
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] );
}
}
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- How to sort an array
- Sort an array and search for a value
- Implementing IComparable and sort by Array.Sort
- Array.Sort by CultureInfo
Home » C# Tutorial » Array