Well I would be writing the method into the same module so I would expect the
tokens to be the same. Am I wrong?


Jb Evain-2 wrote:
> 
> Hey,
> 
> On Tue, Jan 12, 2010 at 9:30 PM, Brandon Cuff <[email protected]>
> wrote:
>> Is there some way I can take this byte[] and get an InstructionCollection
>> from it? That way I can create a new MethodDefinition and add it to the
>> module.
> 
> It can't be as simple as that. It will work for very simple opcodes,
> but as soon as you have opcodes that take tokens (that are scoped per
> module) you're toasted. In the idea, you could somehow adapt the
> reflection based CIL reader:
> 
> http://evain.net/blog/articles/2009/04/30/reflection-based-cil-reader
> 
> To decompose the method into a custom Instruction form, and transform
> it back for Cecil, and properly import the references to tokens, but
> it's no small task.
> 
> -- 
> Jb Evain  <[email protected]>
> 
> -- 
> --
> mono-cecil
> 

-- 
View this message in context: 
http://old.nabble.com/Can-I-use-Cecil-to-write-IL-from-a-byte----tp27132028p27136516.html
Sent from the Mono - Cecil mailing list archive at Nabble.com.

-- 
--
mono-cecil

Reply via email to