Browse Source

Fix Equals and GetHashCode in MethodSignature and friends

pull/1/head
Alex Corrado 14 years ago
parent
commit
24fc4f8aae
  1. 16
      src/Mono.VisualC.Interop/Util/MethodSignature.cs

16
src/Mono.VisualC.Interop/Util/MethodSignature.cs

@ -74,11 +74,9 @@ namespace Mono.VisualC.Interop.Util {
public override bool Equals (object obj) public override bool Equals (object obj)
{ {
if (obj == null) var other = obj as BasicSignature;
if (other == null)
return false; return false;
if (obj.GetType () != typeof(BasicSignature))
return false;
BasicSignature other = (BasicSignature)obj;
return IsCompatibleWith (other); return IsCompatibleWith (other);
} }
@ -97,13 +95,11 @@ namespace Mono.VisualC.Interop.Util {
public string Name { get; set; } public string Name { get; set; }
public MethodType Type { 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; return false;
if (obj.GetType () != typeof(MethodSignature))
return false;
MethodSignature other = (MethodSignature)obj;
return IsCompatibleWith (other) && return IsCompatibleWith (other) &&
Type == other.Type && Type == other.Type &&
@ -111,7 +107,7 @@ namespace Mono.VisualC.Interop.Util {
} }
public override int GetHashCode () public new int GetHashCode ()
{ {
unchecked { unchecked {
return base.GetHashCode () ^ return base.GetHashCode () ^

Loading…
Cancel
Save