1.) Generic List of Integers:
List<int> intList = new List<int>();
intList.Add(1);
intList.Add(2);
intList.Add(3);
2.) List of Integer-Arrays:
List<int[]> intArrayList = new List<int[]>();
intArrayList.Add(new int[]{1, 2, 3});
intArrayList.Add(new int[]{4, 5, 6});
intArrayList.Add(new int[]{7, 8, 9});
3.) Array of List of Integers:
List<int>[] listArray = new List<int>() {
new List<int>(),
new List<int>(),
new List<int>()
}
listArray[0].Add(1);
listArray[0].Add(2);
listArray[0].Add(3);
listArray[1].Add(4);
listArray[1].Add(5);
listArray[1].Add(6);
For clarity, i did not use the var-keyword.
Thats how you would build up the various constructs, case 3.) is possible, but doesnt feel right. However, it all depends on what you are trying to achieve.
Remember to initialize instances of List<t> with a count, if you know how many calls to Add you are going to do (that is, how much elements the List-instance will hold), so the Runtime can reserve enough space for the elements. Otherwise the runtime will enlarge the List every 4 (or so)Elements, which will result in poor performance (refer
MSDN [
^]for mor details)