|
by Paulo Morgado via Paulo Morgado : C# on 4/14/2010 11:50:42 PM
In my last post, I went through what is variance in .NET 4.0 and C# 4.0 in a rather theoretical way. Now, I’m going to try to make it a bit more down to earth. Given: class Base { }
class Derived : Base { }
Such that:
Trace.Assert(typeof(Base).IsClass && typeof(Derived).IsClass && typeof(Base).IsGreaterOrEqualTo(typeof(Derived)));
Covariance
interface ICovariantIn<out T> { }
Trace.Assert(typeof(ICovariantIn<Base>).IsGreaterOrEqual
... [ read more ]
|