Daniel Fortunov


 

 Daniel Fortunov's Adventures in Software Development »
Viewing Posts matching 'variance'

Explicit co-variance and contra-variance for delegate and interface type parameters in C# 4.0

 0 Comments- Add comment Written on 19-Apr-2009 by asqui

Last 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 

Send to a friend
Loading …
  • Server: web4.webjam.com
  • Total queries:
  • Serialization time: 156ms
  • Execution time: 187ms
  • XSLT time: $$$XSLT$$$ms