Murali Poola
How can I create variant generic interfaces and delegates myself?
By Murali Poola in .NET on Apr 23 2012
  • Murali Poola
    Apr, 2012 23

    The out keyword marks a type parameter as covariant, and the in keyword marks it as contravariant. The two most important rules to remember:

    • You can mark a generic type parameter as covariant ifit is used only as a method return type and is not used as a type offormal method parameters.
    • And vice versa, you can mark a type as contravariant ifit is used only as a type of formal method parameters and not used as amethod return type.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS