11

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

How?

smartcaveman
  • 41,281
  • 29
  • 127
  • 212

2 Answers2

17

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.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
0

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.

flq
  • 22,247
  • 8
  • 55
  • 77