How to read a method body with reflection

3.3k views Asked by At

Is it possible to find out anything about a Method body with reflection?

How?

2

There are 2 answers

1
Jon Skeet On BEST ANSWER

You can use MethodInfo.GetMethodBody.

That provides you access to anything you want... if you're happy to work through the IL etc yourself.

It's possible that the Mono Cecil library will provide more help - I haven't used it myself.

0
flq On

Talking of Mono.Cecil, it will give you access to the method body in a way that will look very familiar if you have ever peeked into a .NET assembly with ILDASM.