public static bool Is(this MethodReference method, string fullName) { if (method == null) { return(false); } if (fullName.Contains(" ", StringComparison.Ordinal)) { // Namespace.Type::MethodName if (method.GetID(withType: true, simple: true).Replace("+", "/", StringComparison.Ordinal) == fullName.Replace("+", "/", StringComparison.Ordinal)) { return(true); } // ReturnType Namespace.Type::MethodName(ArgType,ArgType) if (method.GetID().Replace("+", "/", StringComparison.Ordinal) == fullName.Replace("+", "/", StringComparison.Ordinal)) { return(true); } } return(method.FullName.Replace("+", "/", StringComparison.Ordinal) == fullName.Replace("+", "/", StringComparison.Ordinal)); }
public static bool Is(this MethodReference method, Type type, string name) { if (method == null) { return(false); } if (name.Contains(" ", StringComparison.Ordinal)) { // ReturnType MethodName(ArgType,ArgType) if (method.DeclaringType.FullName.Replace("+", "/", StringComparison.Ordinal) == type.FullName.Replace("+", "/", StringComparison.Ordinal) && method.GetID(withType: false).Replace("+", "/", StringComparison.Ordinal) == name.Replace("+", "/", StringComparison.Ordinal)) { return(true); } } return(method.DeclaringType.FullName.Replace("+", "/", StringComparison.Ordinal) == type.FullName.Replace("+", "/", StringComparison.Ordinal) && method.Name == name); }