nunit-dev team mailing list archive
-
nunit-dev team
-
Mailing list archive
-
Message #00182
Re: Feature 676560 - IEquatable
Hi Simone,
I figured I could wait a few hours before writing you again, because
of your time zone. I
guess you're a night owl!
On Fri, Oct 21, 2011 at 2:53 PM, Simone Busoli <simone.busoli@xxxxxxxxx> wrote:
> Hi, unless I'm missing something - Charlie said on the "bug" page that it's
> not trivial - all I would do is insert an additional routine call before the
> default fallback to x.Equals(y) in NUnitEqualityComparer which would:
Two issues about this:
1. Inserting the change right before the fallback x.Equals(y) sounds
good to me at least
for now. It will mess up folks with a class that implements
ICollection, but I think we
can live with that.
2. The code itself is going to be reflection-based and reflection on
generic types is
a bit hairy, but I think it's doable.
> check if both x and y implement IEquatable<>
> check that they both implement IEquatable of the same T
> if the two above apply, call the IEquatable<T>.Equals method somehow, using
> reflection perhaps
I think you can check the types first and ensure that they are the
same type. I'm
not sure there's a case for a type T1 that implements IEquatable<T2>, but I
could be wrong.
> In any case, I'm not sure we're still supporting .NET 1.x, in that case this
> would go under a pre-processing direct
We are in 2.6, so put it all under #if CLR_2_0 || CLR_4_0.
Charlie
_____________
> Mailing list: https://launchpad.net/~nunit-dev
> Post to : nunit-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~nunit-dev
> More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References