Inlinable MulticastDelegate == (#16431)
authorBen Adams <thundercat@illyriad.co.uk>
Sat, 17 Feb 2018 19:24:53 +0000 (19:24 +0000)
committerJan Kotas <jkotas@microsoft.com>
Sat, 17 Feb 2018 19:24:53 +0000 (11:24 -0800)
src/mscorlib/src/System/MulticastDelegate.cs

index 39d6723..ef630bc 100644 (file)
@@ -4,8 +4,6 @@
 
 using System;
 using System.Reflection;
-using System.Runtime;
-using System.Runtime.CompilerServices;
 using System.Runtime.Serialization;
 using System.Diagnostics;
 using System.Reflection.Emit;
@@ -431,18 +429,22 @@ namespace System
 
         public static bool operator ==(MulticastDelegate d1, MulticastDelegate d2)
         {
-            if ((Object)d1 == null)
-                return (Object)d2 == null;
+            if (ReferenceEquals(d1, d2))
+            {
+                return true;
+            }
 
-            return d1.Equals(d2);
+            return d1 is null ? false : d1.Equals(d2);
         }
 
         public static bool operator !=(MulticastDelegate d1, MulticastDelegate d2)
         {
-            if ((Object)d1 == null)
-                return (Object)d2 != null;
+            if (ReferenceEquals(d1, d2))
+            {
+                return false;
+            }
 
-            return !d1.Equals(d2);
+            return d1 is null ? true : !d1.Equals(d2);
         }
 
         public override sealed int GetHashCode()