Below code work perfectly fine unless I change GetCount parameter type from ICollection to dynamic - it throws RuntimrBinderException Why at runtime Count property is not available ?
static void Main(string[] args)
{
var list = new int[] { 1, 2, 3 };
var x = GetCount(list);
Console.WriteLine(x);
}
private static int GetCount(ICollection array) /*changing array type to dynamic fails at runtime*/
{
return array.Count;
}