From ed746c8a2a4dea973ca0c54d8ca2573596457d85 Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Mon, 23 May 2016 10:49:05 +0200 Subject: [PATCH] [Fix] Overload the == and != operators of the NSUrl class. --- src/Foundation/NSUrl.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Foundation/NSUrl.cs b/src/Foundation/NSUrl.cs index 333602cc8030..aa1f4926b62a 100644 --- a/src/Foundation/NSUrl.cs +++ b/src/Foundation/NSUrl.cs @@ -142,6 +142,21 @@ public bool SetResource (NSString nsUrlResourceKey, NSObject value) return SetResourceValue (value, nsUrlResourceKey, out error); } + public static bool operator == (NSUrl x, NSUrl y) + { + if ((object) x == (object) y) // If both are null, or both are same instance, return true. + return true; + + if (((object) x == null) || ((object) y == null)) // If one is null, but not both, return false. + return false; + + return x.Equals (y); + } + + public static bool operator != (NSUrl x, NSUrl y) + { + return !(x == y); + } } #if !XAMCORE_3_0