[Mono-dev] [PATCH] System.Transactions.Transaction

Alan McGovern alan.mcgovern at gmail.com
Wed Nov 15 02:50:17 EST 2006


Isn't it more usual to implement Equality and then  for InEquality just:
return !obj.Equals(otherObj); Easier to maintain ;)

Alan.


On 11/15/06, Raja R Harinath <rharinath at novell.com> wrote:
>
> Hi,
>
> "Matthijs ter Woord" <matthijsterwoord at gmail.com> writes:
>
> > In the attached diff file, is a change for implementing the == and !=
> > operators of System.Transactions.Transaction.
> >
> > Please review and commit...
> >
> > Index: Transaction.cs
> > ===================================================================
> > --- Transaction.cs    (revision 67816)
> > +++ Transaction.cs    (working copy)
> > @@ -57,6 +57,7 @@
> >               internal Transaction (Transaction other)
> >               {
> >                       level = other.level;
> > +
> >                       info = other.info;
> >                       dependents = other.dependents;
> >               }
> > @@ -198,15 +199,20 @@
> >               }
> >
> >               [MonoTODO]
> > -             public static bool op_Inequality (Transaction x,
> Transaction y)
> > +             public static bool operator != (Transaction x, Transaction
> y)
> >               {
> > -                     if (x == null && y == null)
> > -                             return false;
> > -                     if (x == null || y == null)
> > +                     if ((x as object) == null && (y as object) ==
> null)
> > +                         return false;
>
> I'd prefer
>
>     ReferenceEquals (x, null)
>
> instead.  Also, please use the proper indentation.
>
> - Hari
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061115/97dd6c9e/attachment.html 


More information about the Mono-devel-list mailing list