Posterous theme by Cory Watilo

What's the difference between covariance and assignment compatibility?

So now we can define covariance, contravariance and invariance. A generic type I<T> is covariant (in T) if construction with reference type arguments preserves the direction of assignment compatibility. It is contravariant (in T) if it reverses the direction of assignment compatibility. And it is invariant if it does neither. And by that, we simply are saying in a concise way that the projection which takes a T and produces I<T> is a covariant/contravariant/invariant projection.

Eric Lippert describes what the real meaning of covariance and contravariance is. That's great and all but I find myself not really caring and just wanting to know what it means in reference to generics. I thought I understood, but maybe not anymore...?

Luckily, at there is an update to the post that explains things in terms of Twilight.