[corlib] Remove redundant checks from delegate::combine
authorMarek Safar <marek.safar@gmail.com>
Tue, 27 Jan 2015 18:46:17 +0000 (19:46 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 27 Jan 2015 18:46:55 +0000 (19:46 +0100)
mcs/class/corlib/System/Delegate.cs
mcs/class/corlib/System/MulticastDelegate.cs

index 8b9ade4dd46b7159f2295bbba42f1caee1910819..26fff1d5c463c1d5886bb39fac040f1cd5e2b119 100644 (file)
@@ -524,17 +524,9 @@ namespace System
                /// </symmary>
                public static Delegate Combine (Delegate a, Delegate b)
                {
-                       if (a == null) {
-                               if (b == null)
-                                       return null;
+                       if (a == null)
                                return b;
-                       } else 
-                               if (b == null)
-                                       return a;
 
-                       if (a.GetType () != b.GetType ())
-                               throw new ArgumentException (Locale.GetText ("Incompatible Delegate Types. First is {0} second is {1}.", a.GetType ().FullName, b.GetType ().FullName));
-                       
                        return a.CombineImpl (b);
                }
 
index 0550ff82843fd239d47fd94d68bf4d071ae3e5de..1a869578a1c6088679c5d428434bf0a420aacbeb 100644 (file)
@@ -143,6 +143,9 @@ namespace System
                // </summary>
                protected sealed override Delegate CombineImpl (Delegate follow)
                {
+                       if (follow == null)
+                               return this;
+
                        MulticastDelegate combined, orig, clone;
 
                        if (this.GetType() != follow.GetType ())