1
Reply

What is Co- and Contra-Variance in C#?

Amit Kumar

Amit Kumar

12y
952
0
Reply

    CovarianceEnables you to use a more derived type than originally specified. You can assign an instance of IEnumerable (IEnumerable(Of Derived) in Visual Basic) to a variable of type IEnumerable.ContravarianceEnables you to use a more generic (less derived) type than originally specified. You can assign an instance of IEnumerable (IEnumerable(Of Base) in Visual Basic) to a variable of type IEnumerable.