Two a day keeps stagnation away
A Practical Intro to Covariance and Contravariance in C#

A Practical Intro to Covariance and Contravariance in C#

When defining a generic interface, have you received a hint from Resharper like “The type parameter T could be declared as covariant” (or “contravariant”)? If so, have you then blindly applied the proposed refactoring which decorates your generic parameter with the in or out keyword? Like so: publicinterface ISomeGenericInterface<in T>

Read more: https://vkontech.com/a-practical-intro-to-covariance-and-contravariance-in-c/

Leave a Reply

Your email address will not be published. Required fields are marked *