Chapter-5
Chapter-5
Class Structure
To access individual elements of a multidimensional array, you simply specify the indices
separated by commas:
hillHeight[2,1]
The foreach loop gives you access to all elements in a multidimensional way, just as with
singledimensional arrays:
double[,] hillHeight = { { 1, 2, 3, 4 }, { 2, 3, 4, 5 }, { 3, 4, 5, 6 } };
foreach (double height in hillHeight)
{
Console.WriteLine("{0}", height);
Arrays of Arrays:-
A jagged array is an array of array. Jagged arrays store arrays instead of literal
values.
A jagged array is initialized with two square brackets [][].
The first bracket specifies the size of an array, and the second bracket specifies the
dimensions of the array which is going to be stored.