Imagine the following list:
List<List<List<String>>> listRoot = new List<List<List<String>>>();
I want to count the elements of the first and the second list and return the accumulated value:
int iFirstListCounter = 0;
int iSecondListCounter = 0;
foreach (List<List<String>> listFirst in listRoot)
{
iFirstListCounter += listFirst.Count;
foreach (List<String> listSecond in listFirst)
{
iSecondListCounter += listSecond.Count;
}
}
return iFirstListCounter + iSecondListCounter;
I just wonder if it's possible to do this using LINQ?