Co- and Contravariance

image While most of the C# 4.0 set of language features deals with dynamic typing and simplifying interoperability scenarios, one other feature made it in to the language. Generic co- and contravariance is a powerful feature with a scary name. Luckily, you won’t have to deal with it directly that often. Instead, this new feature makes working with certain generic interfaces and delegates easier. Let’s have a look.

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.