From 0fe131515c9956c594c44fe418ba95e3ad89854c Mon Sep 17 00:00:00 2001 From: AndrewSt Date: Mon, 19 Sep 2016 23:22:18 +0300 Subject: [PATCH] Improve Equals Size2, SizeF --- Source/SharpDX/Size2.cs | 5 +++-- Source/SharpDX/Size2F.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/SharpDX/Size2.cs b/Source/SharpDX/Size2.cs index 2b75ce1b5..09ae59a8a 100644 --- a/Source/SharpDX/Size2.cs +++ b/Source/SharpDX/Size2.cs @@ -75,8 +75,9 @@ public bool Equals(Size2 other) /// public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) return false; - if (obj.GetType() != typeof(Size2)) return false; + if (!(obj is Size2)) + return false; + return Equals((Size2)obj); } diff --git a/Source/SharpDX/Size2F.cs b/Source/SharpDX/Size2F.cs index 8d64ee849..091bb1659 100644 --- a/Source/SharpDX/Size2F.cs +++ b/Source/SharpDX/Size2F.cs @@ -75,8 +75,9 @@ public bool Equals(Size2F other) /// public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) return false; - if (obj.GetType() != typeof(Size2F)) return false; + if (!(obj is Size2F)) + return false; + return Equals((Size2F)obj); }