Jagged Arrays in C#

Jagged Arrays:

In C#, a Jagged array is an array of arrays such that member arrays can be of different sizes. It can also be mixed with multidimensional arrays. The elements of Jagged Array are reference types and initialized to null by default.

Example:

using System;
using System.Collection.Generic;
using System.Text;
namespace JaggedArray
{
class Test
{
static void Main(string[] args)
{
const int rows=3;
int[][] jagArr=new int [rows][];
jagArr[0]=new int[2];
jagArr[1]=new int[3];
jagArr[2]=new int[4];
jagArr[0][1]=50;
jagArr[1][0]=25;
jagArr[1][1]=20;
jagArr[2][0]=60;
jagArr[2][3]=250;
for(int i=0;i<2;i++)
{
Console.WriteLine("This is jagged Array 1 having elements:[0][{0}]={1}",i, jagArr[0][i]);
}
for(i=0;i<3;i++)
{
Console.WriteLine("This is jagged Array 2 having elements:[1][{0}]={1}",i, jagArr[1][i]);
}
for(i=0;i<4;i++)
{
Console.WriteLine("This is jagged Array 3 having elements:[2][{0}]={1}",i, jagArr[2][i]);
}
}
}
}