From 24fc4f8aaea17d89a6a13ccb80e1f004a59c9086 Mon Sep 17 00:00:00 2001 From: Alex Corrado Date: Sun, 5 Jun 2011 18:38:35 -0400 Subject: [PATCH] Fix Equals and GetHashCode in MethodSignature and friends --- src/Mono.VisualC.Interop/Util/MethodSignature.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Mono.VisualC.Interop/Util/MethodSignature.cs b/src/Mono.VisualC.Interop/Util/MethodSignature.cs index 1364529c..afc1d7a1 100644 --- a/src/Mono.VisualC.Interop/Util/MethodSignature.cs +++ b/src/Mono.VisualC.Interop/Util/MethodSignature.cs @@ -74,11 +74,9 @@ namespace Mono.VisualC.Interop.Util { public override bool Equals (object obj) { - if (obj == null) + var other = obj as BasicSignature; + if (other == null) return false; - if (obj.GetType () != typeof(BasicSignature)) - return false; - BasicSignature other = (BasicSignature)obj; return IsCompatibleWith (other); } @@ -97,13 +95,11 @@ namespace Mono.VisualC.Interop.Util { public string Name { get; set; } public MethodType Type { get; set; } - public override bool Equals (object obj) + public new bool Equals (object obj) { - if (obj == null) + var other = obj as MethodSignature; + if (other == null) return false; - if (obj.GetType () != typeof(MethodSignature)) - return false; - MethodSignature other = (MethodSignature)obj; return IsCompatibleWith (other) && Type == other.Type && @@ -111,7 +107,7 @@ namespace Mono.VisualC.Interop.Util { } - public override int GetHashCode () + public new int GetHashCode () { unchecked { return base.GetHashCode () ^