The new Generic Collection feature Covariance and Contravariance

10-September-2010


Here's a quick reference for Generic co- and contravariance is new in C# 4.

If T appears only as an output, it’s safe to pass .List<TDerived> for List<T>. (Co-variance).

If T appears only as an input, it’s safe to pass List<TBase> for List<T>. (Contra-variance).




Comments