This project is read-only.

MemberHelper.GetMethodSignature

Aug 11, 2011 at 9:46 AM

We are looking for some kind of "signature string", unambiguously identifying a method according to the ECMA 335 standard (see § 8.6.1.5 Method signatures). Is there any way to get such a string using MemberHelper.GetMethodSignature? We don't see a way to retrieve the calling convention or the number of generic parameters instead of a list of all generic parameters, and some other minor details.

Best regards,

D.R.

Aug 12, 2011 at 3:12 AM

Unfortunately this is not the goal of MemberHelper.GetMethodSignature. Depending on how much of its functionality you'd want to retain, you could create your own subclass of SignatureFormatter and override some of its methods.

Aug 18, 2011 at 10:21 AM

For type signatures you can use this construct:

TypeHelper.GetTypeName (
    typeDefinition,
    NameFormattingOptions.OmitTypeArguments |
    NameFormattingOptions.UseGenericTypeNameSuffix |
    NameFormattingOptions.UseReflectionStyleForNestedTypeNames
);

I will post something on method signatures as soon as we've developed it.

(Feedback is welcome)

Best regards,

D.R.

Aug 18, 2011 at 5:57 PM

That will get you unambiguous type names. Getting unambiguous names for methods is a bit harder, particularly when the assembly in question was written in C++ or ilasm, or perhaps post-processed (for example, for obfuscation purposes).

If you are willing to live with the C# view of the world, then NameFormattingOptions.FormattingForDocumentationId should do the trick.