Why was IEnumerable<T> made covariant in C# 4?
问题 In earlier versions of C# IEnumerable was defined like this: public interface IEnumerable<T> : IEnumerable Since C# 4 the definition is: public interface IEnumerable<out T> : IEnumerable Is it just to make the annoying casts in LINQ expressions go away? Won't this introduce the same problems like with string[] <: object[] (broken array variance) in C#? How was the addition of the covariance done from a compatibility point of view? Will earlier code still work on later versions of .NET or is