Get the Count of a List of unknown type
You could do this
var property = typeof(ICollection).GetProperty("Count");
int count = (int)property.GetValue(list, null);
assuming you want to do this via reflection that is.
Cast it to ICollection and use that .Count
using System.Collections;
List<int> list = new List<int>(Enumerable.Range(0, 100));
ICollection collection = list as ICollection;
if(collection != null)
{
Console.WriteLine(collection.Count);
}