"Covariant and Contravariant Generic Parameters in Interfaces"

interface ICovariant<out T> { }
interface IContravariant<in T> { }

static void Test() {
	ICovariant<object> covariantObj;
	ICovariant<int> covariantInt = GetCovariant<int>();
	
	covariantObj = covariantInt; // "out T" in ICovariant allows this
	
	
	
	IContravariant<object> contravariantObj = GetContravariant<object>();
	IContravariant<int> contravariantInt;
	
	contravariantInt = contravariantObj; // "in T" in IContravariant allows this
}


Code snippet taken from "Two Decades of C#: A Reference - C# 2, 3 and 4".