我沒有找到任何描述或解釋如何將 List< List of int> 作為引數插入方法中的值或 Console.WriteLine()
我已經嘗試了一些變體,但它們似乎都不起作用。所以我想在這里尋求幫助。
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Result.ListManipulation()));
//I want to insert 3 Lists and manipulate with them inside the method
//List<int>{11, 2, 4 };
//List<int>{4, 5, 6};
//List<int>{10, 8, -12};
Console.ReadLine();
}
}
class Result
{
public static int ListManipulation(List<List<int>> arr)
{
//Manipulation with those 3 Lists
return 0;
}
}
如果您有一些易于使用的解釋,我愿意為您提供知識!
謝謝你的幫助
uj5u.com熱心網友回復:
您應該做的就是創建和填充嵌套 List<List<int>>:
...
// You should create a nested List - new List<List<int>>()...
List<List<int>> myList = new List<List<int>>() {
// ... and fill it line by line
new List<int>() { 11, 2, 4 },
new List<int>() { 4, 5, 6 },
new List<int>() { 10, 8, -12 },
};
int result = ListManipulation(myList);
...
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/504872.html
上一篇:在unpivot中洗掉NULLS
