public override bool Equals(object obj) { MethodWrapper other = (MethodWrapper)obj; if (method.Name != other.method.Name) { return(false); } return(0 == DiffUtility.Compare(method.Parameters, other.method.Parameters)); }
public void ParameterComparisonTest() { DefaultParameter p1 = new DefaultParameter("a", mscorlib.GetClass("System.String", 0).DefaultReturnType, DomRegion.Empty); DefaultParameter p2 = new DefaultParameter("b", new GetClassReturnType(mscorlib, "System.String", 0), DomRegion.Empty); IList <IParameter> a1 = new List <IParameter>(); IList <IParameter> a2 = new List <IParameter>(); a1.Add(p1); a2.Add(p2); Assert.AreEqual(0, DiffUtility.Compare(a1, a2)); }
static bool InterfaceMemberAlreadyImplementedParametersAreIdentical(IMember a, IMember b) { if (a is IMethodOrProperty && b is IMethodOrProperty) { return(DiffUtility.Compare(((IMethodOrProperty)a).Parameters, ((IMethodOrProperty)b).Parameters) == 0); } else { return(true); } }
static bool IsSimilarMemberInternal(IMember member1, IMember member2) { if (member1 == member2) { return(true); } if (member1 == null || member2 == null) { return(false); } if (member1.FullyQualifiedName != member2.FullyQualifiedName) { return(false); } if (member1.IsStatic != member2.IsStatic) { return(false); } if (member1 is IMethod) { if (member2 is IMethod) { if (DiffUtility.Compare(((IMethod)member1).Parameters, ((IMethod)member2).Parameters) != 0) { return(false); } } else { return(false); } } if (member1 is IProperty) { if (member2 is IProperty) { if (DiffUtility.Compare(((IProperty)member1).Parameters, ((IProperty)member2).Parameters) != 0) { return(false); } } else { return(false); } } return(true); }
public static IMember FindSimilarMember(IClass type, IMember member) { if (member is IMethod) { IMethod parentMethod = (IMethod)member; foreach (IMethod m in type.Methods) { if (string.Equals(parentMethod.Name, m.Name, StringComparison.InvariantCultureIgnoreCase)) { if (m.IsStatic == parentMethod.IsStatic) { if (DiffUtility.Compare(parentMethod.Parameters, m.Parameters) == 0) { return(m); } } } } } else if (member is IProperty) { IProperty parentMethod = (IProperty)member; foreach (IProperty m in type.Properties) { if (string.Equals(parentMethod.Name, m.Name, StringComparison.InvariantCultureIgnoreCase)) { if (m.IsStatic == parentMethod.IsStatic) { if (DiffUtility.Compare(parentMethod.Parameters, m.Parameters) == 0) { return(m); } } } } } return(null); }