/// <summary> /// Gets the valid full method signature associated with the given /// <see cref="MethodReference"/>. /// </summary> /// <param name="methodReference">The method reference.</param> /// <returns>The valid full method signature.</returns> public static string GetCompatibleFullName(this MethodReference methodReference) { var genericParams = methodReference.GenericParameters.Concat( methodReference.DeclaringType.GetAllGenericParameters()); var procName = methodReference.GetFullNameWithoutReturnType().Replace("/", "$"); procName = genericParams.Aggregate( procName, (pn, p) => pn.Replace(p.Name, methodReference.Module.TypeSystem.Object.FullName)); procName = methodReference.ReturnType.GetCompatibleFullName() + " " + procName; if (methodReference.DeclaringType != null) { procName = procName.Replace(methodReference.DeclaringType.FullName, methodReference.DeclaringType.GetCompatibleFullName()); } return(procName); }