IDictionary in .NET 4 not covariant
It’s a feature. .NET 4.0 only supports safe covariance. The cast you mentioned is potentially dangerous as you could add a non-string element to the dictionary if that was possible: IDictionary<string, object> myDict = new Dictionary<string, string>(); myDict[“hello”] = 5; // not an string On the other hand, IEnumerable<T> is a read-only interface. The T … Read more