* Transaction.cs (operator==, operator!=): Implement.
authorRaja R Harinath <harinath@hurrynot.org>
Mon, 20 Nov 2006 12:29:04 +0000 (12:29 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Mon, 20 Nov 2006 12:29:04 +0000 (12:29 -0000)
Reported by "Matthijs ter Woord" <matthijsterwoord@gmail.com>.

svn path=/trunk/mcs/; revision=68186

mcs/class/System.Transactions/System.Transactions/ChangeLog
mcs/class/System.Transactions/System.Transactions/Transaction.cs

index b30c545c0837b3082eadb70b1c7cc8f214c1c407..9d4fc34e8aa34591cf7ad0eaa173a7998500e563 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-20  Raja R Harinath  <rharinath@novell.com>
+
+       * Transaction.cs (operator==, operator!=): Implement.
+       Reported by "Matthijs ter Woord" <matthijsterwoord@gmail.com>.
+
 2006-08-09  Duncan Mak  <duncan@novell.com>
 
        * IPromotableSinglePhaseNotification.cs (Promote): Removed because
index 07cff16e00729ce45422516b13baed119c89deec..620d176133a67e134f6c72774efa09974eff0792 100644 (file)
@@ -186,26 +186,33 @@ namespace System.Transactions
                        /* FIXME: Enlistment.. ? */
                        return new Enlistment ();
                }
-                               
-               [MonoTODO]
+
                public override bool Equals (object obj)
                {
-                       Transaction t = obj as Transaction;
-                       if (t == null)
+                       return Equals (obj as Transaction);
+               }
+
+               // FIXME: Check whether this is correct (currently, GetHashCode() uses 'dependents' but this doesn't)
+               private bool Equals (Transaction t)
+               {
+                       if (ReferenceEquals (t, this))
+                               return true;
+                       if (ReferenceEquals (t, null))
                                return false;
                        return this.level == t.level &&
                                this.info == t.info;
                }
 
-               [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)
-                               return true;
+                       if (ReferenceEquals (x, null))
+                               return ReferenceEquals (y, null);
+                       return x.Equals (y);
+               }
 
-                       return ! x.Equals (y);
+               public static bool operator != (Transaction x, Transaction y)
+               {
+                       return !(x == y);
                }
 
                public override int GetHashCode ()