I have a list which contains three items. First element is integer, second one is also an integer and third one is another list. By using for each loop I'm able to print these items.
List<object> mainList= new List<object>();
mainList.Add(binRead.ReadInt32()); // Reads first integer ant adds to mainList
mainList.Add(binRead.ReadInt32()); // Reads second integer ant adds to mainList
List<object> avlDataList = new List<object>();
for(int i=0; i<n; i++)
{
// Reads some data and adds it to avlDataList
}
mainList.Add(avlDataList); // Adds that list to mainList
foreach(var i in mainList)
{
Console.WriteLine(i); // Prints items
}
I get this output:
8
1
System.Collections.Generic.List`1[System.Object]
How can I modify my code to see what's inside of that list instead of getting this message? That avlDataList list has 10 elements. So i would like to see 12 elements in total.