Suppose you have a binary representation of a field signature in a .NET module, like 0604
. The 6 (FIELD
) represents the field calling convention and the 4 (ELEMENT_TYPE_I1
) represents the I1
primitive type (see ECMA-335 for more on CIL). The signature can be from a debugger or assembly inspector, that is not important. What's more important, is it possible (using methods provided by .NET) to "parse" this signature and get the corresponding .NET type that the signature is representing?
Examples:
0601
⇒ System.Void
0604
⇒ System.SByte
060E
⇒ System.String
061408020000
⇒ System.Int32[,]
There are some internal .NET methods that can do that:
This loads any valid field signature and returns the appropriate type.