C#4.0: How to find out if types are co-variantly equal

Posted by George Mauer on Stack Overflow See other posts from Stack Overflow or by George Mauer
Published on 2010-05-28T03:19:25Z Indexed on 2010/05/28 3:21 UTC
Read the original article Hit count: 236

Filed under:
|
|
|
|

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()

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET