Jagged Arrays
string s = "";
for(j = 0;j<=2;j++)
{
if
(s.Equals(""))
{
s = arrsummary[i, j];
}
else
{
s = s + " - " + arrsummary[i, j];
}
}
Console.WriteLine(s);
}
Jagged Arrays
A jagged array is an array whose elements are arrays. The elements of a jagged array can
be of different dimensions and sizes. A jagged array is sometimes called an "array-of-
arrays."
//Decalaring a Jagged Array
int[][] myJaggedArray = new int[3][];
//Initialize the elements of the Jagged Array
myJaggedArray[0] = new int[5];
myJaggedArray[1] = new int[4];
myJaggedArray[2] = new int[2];
//Fill array elements with values.
myJaggedArray[0] = new int[] {1,3,5,7,9};
myJaggedArray[1] = new int[] {0,2,4,6};
myJaggedArray[2] = new int[] {11,22};
You can access individual array elements like these examples:
// Assign 33 to the second element of the first array:
myJaggedArray[0][1] = 33;
// get the value of second element of the third array:
int i = myJaggedArray[2][1];
Few Important methods in arrays.