Is there any existing functionality in the .NET BCL to print the full signature of a method at runtime (like what you’d see in the Visual Studio ObjectBrowser – including parameter names) using information available from MethodInfo?
So for example, if you look up String.Compare() one of the overloads would print as:
public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, System.Globalization.CultureInfo culture)
Note the presence of the complete signature with all access and scope qualifiers as well as a complete list of parameters including names. This is what I’m looking for. I could write my own method, but I would rather use an existing implementation if possible.
Unfortunately I don’t believe there is a built in method that would do that. Your best be would be to create your own signature by investigating the MethodInfo class
EDIT: I just did this
and you get
This might not be what you’re looking for, but it’s close.
How about this
This is the result