public int GetHashCode(IList <IParameter> obj) { int hashCode = obj.Count; unchecked { foreach (IParameter p in obj) { hashCode *= 27; IType type = DummyTypeParameter.NormalizeMethodTypeParameters(p.Type); hashCode += type.GetHashCode(); } } return(hashCode); }
public bool Equals(IList <IParameter> x, IList <IParameter> y) { if (x == y) { return(true); } if (x == null || y == null || x.Count != y.Count) { return(false); } for (int i = 0; i < x.Count; i++) { var a = x[i]; var b = y[i]; if (a == null && b == null) { continue; } if (a == null || b == null) { return(false); } // We want to consider the parameter lists "Method<T>(T a)" and "Method<S>(S b)" as equal. // However, the parameter types are not considered equal, as T is a different type parameter than S. // In order to compare the method signatures, we will normalize all method type parameters. IType aType = DummyTypeParameter.NormalizeMethodTypeParameters(a.Type); IType bType = DummyTypeParameter.NormalizeMethodTypeParameters(b.Type); if (!aType.Equals(bType)) { return(false); } } return(true); }
public IType NormalizeMethodTypeParameters(IType type) { return(DummyTypeParameter.NormalizeMethodTypeParameters(type)); }