What is Co- and Contra-Variance in C#?
Amit Kumar
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.