See Also: MethodBody Members
The System.Reflection.MethodBody class provides access to information about the local variables and exception-handling clauses in a method body, and to the Microsoft intermediate language (MSIL) that makes up the method body.
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.ResolveType(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.
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.
To obtain a System.Reflection.MethodBody object for a given method, first obtain a System.Reflection.MethodInfo object for the method, then call the System.Reflection.MethodInfo object's MethodBase.GetMethodBody method.