user826436
user826436

Reputation: 245

Output a Multi-array

I am struggling to output this multi-array, I have tried looping through using a for each loop ... This is what I see when I insert a break point, which the array 'response' is storing, so how would I go about writing these to the console

response    Count = 6   System.Collections.Generic.List<int[]>
[0] {int[1]}    int[]
     [0]    1577    int
[1] {int[0]}    int[]
[2] {int[0]}    int[]
[3] {int[0]}    int[]
[4] {int[0]}    int[]
[5] {int[6]}    int[]
     [0]    31  int
     [1]    246 int
     [2]    448 int
     [3]    663 int
     [4]    864 int
     [5]    1734    int

Many thanks

Upvotes: 0

Views: 103

Answers (1)

Jalal Said
Jalal Said

Reputation: 16162

foreach (int[] subList in response)
{
    foreach (int item in subList)
    {
        Console.WriteLine(item);
    }
}

Using for loop:

for (int subListIndex = 0; subListIndex < response.Count; subListIndex++)
{
    for (int itemIndex = 0; itemIndex < response[subListIndex].Length; itemIndex++)
    {
        Console.WriteLine(response[subListIndex][itemIndex]);
    }
}

Upvotes: 1

Related Questions