System.Reflection.MethodBody.GetILAsByteArray Method

Returns the MSIL for the method body, as an array of bytes.

Syntax

public virtual byte[] GetILAsByteArray ()

Returns

An array of type byte that contains the MSIL for the method body.

Remarks

You can use the token-resolution methods of the module class, such as Module.ResolveType(int, Type[], Type[]), Module.ResolveMethod(int, Type[], Type[]), and Module.ResolveMember(int, Type[], Type[]), to resolve the tokens in the method body to Type objects, System.Reflection.MethodInfo objects, and System.Reflection.FieldInfo objects that provide detailed information about the types, methods, and fields accessed by the MSIL in the method body.

Note:

Parsing method bodies requires a thorough understanding of metadata and MSIL instruction formats. Information can be found in the Common Language Infrastructure (CLI) documentation, especially "Partition II: Metadata Definition and Semantics" and "Partition III: CIL Instruction Set". The documentation is available online; see tp://go.microsoft.com/fwlink/?LinkID=99212 on MSDN and tp://go.microsoft.com/fwlink/?LinkID=65552 on the Ecma International Web site.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0