我有一个问题,我需要一个 arrayList 数组。
例如,如果我们采用一个由 int 类型的 ArrayList 构成的数组,它将是这样的:
int[]<List> myData = new int[2]<List>;
myData[0] = new List<int>();
myData[0].Add(1);
myData[0].Add(2);
myData[0].Add(3);
myData[1] = new List<int>();
myData[1].Add(4);
myData[1].Add(5);
myData[1].Add(6);
myData[0].Add(7);
我们如何在 C# 中实现上述数据结构?
在 C 中,它就像一个 LinkedList 的数组。我如何在 C# 中执行相同的操作?
最佳答案
var myData = new List<int>[]
{
new List<int> { 1, 2, 3 },
new List<int> { 4, 5, 6 }
};
关于c# - 如何在 C# 中创建一个 List<int> 数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4864557/