我在C#
中解释以下行为时遇到问题class A { }
class Program
{
static void Main(string[] args)
{
IEnumerable<int> a = new List<int> { 1, 2, 3 };
IEnumerable<char> b = "sdf";
IEnumerable<A> c = new List<A> { new A() };
Console.WriteLine(a is IEnumerable<object>); //false
Console.WriteLine(b is IEnumerable<object>); //false
Console.WriteLine(c is IEnumerable<object>); //true
}
}
为什么只有自定义类型列表被识别为IEnumerable&lt;对象&gt;