-5

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.)

AxD
  • 2,714
  • 3
  • 31
  • 53
  • Dont use `DyanmicMethod` then. Go the normal route via `MethodBuilder`. – leppie Jan 11 '15 at 08:35
  • Thanks for helping. But it looks like using MethodBuilder instead of DynamicMethod doesn't help me from creating IL code. – AxD Jan 11 '15 at 13:37
  • I dont understand what you mean by that. – leppie Jan 11 '15 at 19:17
  • The question title is: "Is there a tool to have IL code generated from existing assembly?" That's got nothing to do with which method I'm using to create a dynamic function body. – AxD Jan 12 '15 at 05:54
  • Who downvoted my question? By what reasons? – AxD Jan 12 '15 at 05:55
  • 2
    Asking for downvotes gives you more downvotes and asking for a tool is frowned upon: http://meta.stackoverflow.com/questions/254393/what-exactly-is-a-recommendation-question/254394#254394 – rene Jan 12 '15 at 17:19
  • I see. I assume that's because it's not wanted to endorse the one over the other. However, the term "tool" doesn't necessarily target commercial products or similar. A "tool" could be some SDK tool. Wouldn't this tend to be considered a valid question? With tons of different SDK tools and GitHub projects it's impossible to find a way through. Someone facing the same problem I have could benefit from an answer, I believe. – AxD Jan 12 '15 at 17:23

1 Answers1

1

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.

svick
  • 236,525
  • 50
  • 385
  • 514
  • Thank you. I've found a section in the HowTo section that seems to do the trick. I'll try that. THANKS! – AxD Jan 14 '15 at 19:03