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); }