public static bool IsEqual(this TypeReference x, TypeReference y, bool bCompareGenericParameters) { if (x == null && y == null) { return(true); } if ((x == null && y != null) || (x != null && y == null)) { return(false); } bool lret = false; TypeReference xDeclaring = x.DeclaringType; TypeReference yDeclaring = y.DeclaringType; xDeclaring.IsNotNull(() => xDeclaring = x.DeclaringType.GetElementType()); yDeclaring.IsNotNull(() => yDeclaring = y.DeclaringType.GetElementType()); // Generic parameters are passed as placeholder via method reference // newobj instance void class [BaseLibraryV1]BaseLibrary.ApiChanges.PublicGenericClass`1<string>::.ctor(class [System.Core]System.Func`1<!0>) if (AreTypeNamesEqual(x.Name, y.Name) && x.Namespace == y.Namespace && IsEqual(xDeclaring, yDeclaring, bCompareGenericParameters) && x.Scope.IsEqual(y.Scope)) { if (bCompareGenericParameters) { lret = x.GenericParameters.IsEqual(y.GenericParameters); } else { lret = true; } } if (lret) { // Generics can have GenericInstanceType xGen = x as GenericInstanceType; GenericInstanceType yGen = y as GenericInstanceType; if (xGen != null && yGen != null) { lret = xGen.IsEqual(yGen); } } return(lret); }