C#4.0: How to find out if types are co-variantly equal
- by George Mauer
For example I have
interface ICommand {}
class MovePiece : ICommand {}
class Successful<CMD> where CMD : ICommand {}
and I want the following:
CovariantlyEqual(
typeof(Successful<ICommand>),
typeof(Successful<MovePiece>))
.ShouldEqualTrue()