A Jagged Array is an Array of Array
string[][] Arr = new string[3][];
Arr[0] = new string[3];
Arr[1] = new string[2];
Arr[2] = new string[1];
Arr[0][0] = "Bachelor";
Arr[0][1] = "Masters";
Arr[0][2] = "PHD";
Arr[1][0] = "Bachelor 1";
Arr[1][1] = "Masters 1";
foreach (string[] b in Arr)
{
foreach (string a in b)
{
Console.WriteLine(a);
}
}
Console.ReadKey();
// we can also create a JaggedArray of type object
object[][] arr2 = new object[3][];
arr2[0] = new object[3];
arr2[0][0] = 1;
arr2[0][1] = "String";
arr2[0][2] = Arr;
I Hope it was informative for you and I would like to Thank you for reading
No comments:
Post a Comment