1
Reply

How can I create variant generic interfaces and delegates myself?

Murali Poola

Murali Poola

Apr 23, 2012
2.4k
0

    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.

    Murali Poola
    April 23, 2012
    0