Last Updated: May 22, 2026
Variance is the set of rules that decide when one generic type is assignable to another. Specifically, when Product inherits from Item, is IEnumerable<Product> also an IEnumerable<Item>? The short answer is "sometimes, and only if you ask for it explicitly with out or in." This chapter walks through why the default answer is "no," when the compiler will say "yes," and how the out and in keywords give you control over the trade-off.