Interface type parameter covariance and contravariance in C#
- I would like this blog post to serve as a quick reference that recalls the basic concept of covariant and contravariant type parameters of generic interfaces in the C# language.
- I tried to keep the example as simple as possible. Included comments explain the key points. No long stories and no dissertations.
- The code does nothing, but compiles on C# 4.0 or newer compiler.
- Try deleting the first slash character in the first line to kind of switch between the snippets (BTW this is cool trick 🙂 ).
Category: Quick tip