Understanding Type Parameters, Covariance and Contravariance

Parametrizing code with types will be part of almost every future statically typed language. I think any programmer serious about working with static typing needs to have an understanding of the conceptual territory:

  • What does Type Variance mean?
  • Covariance versus Contravariance
  • Definition-site versus Use-site Variance

I recommend Barry Kelly’s post as an nice summary of the issues:

http://barrkel.blogspot.com/2006/07/covariance-and-contravariance-in-net.html