Daniel Fortunov's Adventures in Software Development » Explicit co-variance and contra-variance for delegate and interface type parameters in C# 4.0
0 Comments- Add comment |
Back to Software Development Blog Written on 19-Apr-2009 by asquiLast week Bart De Smet posted an excellent explanation of co-variance and contra-variance support in the .NET CLR and the new support for this in C# 4.0 that can make our lives easier.
This is by far the most comprehensive and clear explanation of the rather in-depth field of type variance, and features lots of examples (and diagrams!) to help your understanding.
My favourite part of the article was this awesome fruit farmer metaphor:
"This might go unnoticed if the farmer doesn’t enforce runtime fruit/vegetable type safety."
— Bart De Smet
Read the full article here:
C# 4.0 FEATURE FOCUS – PART 4 – CO- AND CONTRA-VARIANCE FOR GENERIC DELEGATE AND INTERFACE TYPES