C# program to create and access Jagged Array of Tuples

Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 829
//create a jagged array
int[][] sampleJaggedArray = new int[][]
new int[] {10,20,30,40,50,60},
new int[] {1,2,3,4,5,6,7,8,9,10,11,12},
new int[] {11,22,33,44},
new int[] {-1,-2,-3,-4,-5,-6}

//create an tuple of jagged array
var jaggedArrayTuple = Tuple.Create(sampleJaggedArray);

//access the tuple of jagged array created
var elementOf4thRow2ndColumn = jaggedArrayTuple.Item1[3][1]; //element of 4th Row and 2nd Column [ -2 ]

Comments or Responses

Login to post response