开发者

Output a Multi-array

开发者 https://www.devze.com 2023-03-21 05:12 出处:网络
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 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


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]);
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消