August 2010
Intermediate to advanced
1224 pages
34h 17m
English
The latest versions of the .NET languages support the concepts of covariance and contravariance. These concepts enable you to reduce restrictions on strong typing when working with delegates, generics, or generic collections of objects. In certain situations, decreasing the type restrictions might increase your ability to re-use code and objects and decrease the need to do a lot of casting or converting in order to provide the right type to a method.
Covariance is the ability to use a more derived type than that which was originally specified by an interface or function signature. For example, you could assign a list of strings to a generic list that only takes objects if that list supports covariance (as strings ...