How to get inner list count?

c#, list

Solution

To get the `i`th list's `Count` property, do the following:

var s = bigList[i].Count;

To get the total items inside each of the inner lists, do this:

bigList.Sum(x => x.Count);

Problem

I have a `List`, 'bigList' which holds a `List` of my custom classes. So if I have 20 lists inside my 'bigList', how do I get the count of one of the inner lists? ``` List<List<myClass>> bigList = new List<List<myClass>>(); for (int i = 0; i < 20; i++) { List<myClass> newList = new List<myClass>(); for (int i = 0; i < 100; i++) { newList.Add(myClass); } bigList.Add(newList); } ``` With this example how do I get the count of the lists inside the bigList? I have not worked with `List` as much as `ArrayList` am I doing this wrong because I would have just stored the lists in an `ArrayList` then used the index to figure out the count of the lists.

Original source