Search code examples
c#arrayslistconsole.writeline

how to print a single cell of an array inside a list of arrays in c#


I have a list of arrays:

List<int[]> a = new List<int[]>();

and i put in it a few arrays

int[] b = new int[3] {1, 2, 3};
int[] c = new int[4] {4, 5, 6, 7};
a.Add(b);
a.Add(c);

how can I print only let's say b[1] out of List a?


Solution

  • You can access it by writing

    Console.WriteLine(a[0][1]);