I need instruction duplicating too. I need to inject instructions of
some method to another one.

On 7 ноя, 01:46, Simon Cropp <[email protected]> wrote:
> i looked at various overloads of Instruction.Create and it seemed I
> would need to do a if,else,else etc on my operand type.
>
> The other option was to call Instruction.Create(OpCode) and then set
> the Operand property.
>
> But that failed because of this check
>
> public static Instruction Create(OpCode opcode)
> {
>     if (opcode.OperandType != OperandType.InlineNone)
>     {
>         throw new ArgumentException("opcode");
>     }
>     return new Instruction(opcode, null);
>
> }
>
> If I already have a valid instruction should there not be a
> Instruction.Clone(Instruction)  ?
>
>
>
>
>
>
>
> On Sun, Nov 7, 2010 at 9:35 AM, Jb Evain <[email protected]> wrote:
> > Hey,
>
> > On Sat, Nov 6, 2010 at 10:42 PM, Simon Cropp <[email protected]> wrote:
> >> Ok I obviously misunderstood what the import does :) I have this working 
> >> now.
>
> > Cool :)
>
> >> And I did not use Instruction.Create because there is no
> >> Instruction.Create(Instruction).
>
> > Right, there's something missing here. Maybe not Instruction.Create
> > but Instruction.Create(OpCode,object).
>
> > --
> > --
> > mono-cecil

-- 
--
mono-cecil

Reply via email to