我有一个问题,我需要ArrayList的数组。
例如,如果我们带参数的ArrayList的数组,这将是这样的:
INT []<列表> myData的=新INT [2]其中,列表&gt ;;
myData的[0] =新的名单,其中,INT>();
myData的[0]。新增(1);
myData的[0]。新增(2);
myData的[0]。新增(3);
myData的[1] =新的名单,其中,INT>();
myData的[1]。新增(4);
myData的[1]。新增(5);
myData的[1]。新增(6);
myData的[0]。新增(7);
在C#中,我们如何实现像上面的一个数据结构?
在C,它像链表的数组。我怎么可以做同样的在C#?
解决方案 VAR的myData =新的名单,其中,INT> []
{
新的List< INT> {1,2,3},
新的List< INT> {4,5,6}
};
I have a problem where I need an array of arrayList.
For example if we take an Array of ArrayList of int, it will be like:
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);
How can we implement a datastructure like the above in C#?
In C, its like a array of LinkedList. How can I do the same in C#?
解决方案var myData = new List<int>[]
{
new List<int> { 1, 2, 3 },
new List<int> { 4, 5, 6 }
};
上一篇:安卓:检测手机短信传出,正确Count手机短信、正确、Count
下一篇:smoothScrollToPosition()只滚动中途在安卓ICS?中途、smoothScrollToPosition、ICS