3

I want to work with MethodInfo, is there a way to cast Cecil's MethodDefinition to MethodInfo?

blez
  • 4,939
  • 5
  • 50
  • 82

1 Answers1

3

No - the two structures, while similar in content, have almost nothing to do with each other.

To quote from this thread on Google Groups:

Cecil does not work with the CLR's Reflection APIs; it has its own internal model, and it loads all assemblies itself, bypassing the CLR's loading mechanism.

That thread gives some ideas on how to get around this fact, but it also correctly states that in most cases the correct answer is to just use the CLR's Reflection system if that is what you really want.

Scott Miller
  • 447
  • 7
  • 18