Co- and Contravariance
I saw an excellent video about co- and contravariance and figured I would note it down in text form. The terms co- and contravariance are not very educational. But luckily there are better terms.
Covariance
Output-variance or read-variance
For example: Dog is Animal, therefore IEnumerable<Dog> is IEnumerable<Animal>
.get() returns a Dog/Animal
Contravariance
Input-variance or write-variance
For example: Cat is Animal, therefore Feeder<Animal> is Feeder<Cat>
.feed(me: Cat/Animal) takes an input