Skip to content

Commit

Permalink
Merge pull request #72 from mandel-macaque/bug-34816
Browse files Browse the repository at this point in the history
[Fix] Overload the == and != operators of the NSUrl class.
  • Loading branch information
mandel-macaque committed May 23, 2016
2 parents 6ca327e + ed746c8 commit 9b24047
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Foundation/NSUrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b24047

Please sign in to comment.