Search code examples
.netreflection.emitildynamicmethod

System.Reflection.Emit::DynamicMethod: Is there a tool to have IL code generated from existing assembly?


I want to create a dynamic method with code that's a bit more than trivial.

So I want to create a hard coded version of the method body and have a compiled version of it examined by some tool that's returning OpCos and parameters to me so I can insert them using ILGenerator::Emit().

Is there such tool available? (Maybe that's a stupid question. I couldn't find it using Google, though.)


Solution

  • Your question is pretty vague, so I can give you only a vague answer: try Mono Cecil. It allows you to inspect IL in an existing assembly and modify it, which sounds close to what you're asking.