vs in Generics

The out keyword in generics is used to denote that the type T in the interface is covariant. See Covariance and contravariance for details. The classic example is IEnumerable<out T>. Since IEnumerable<out T> is covariant, you’re allowed to do the following: IEnumerable<string> strings = new List<string>(); IEnumerable<object> objects = strings; The second line above would … Read more