From e3b057509395e6479779a0d22651e98bea3fbc91 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 28 Jan 2022 11:36:20 +0100 Subject: [PATCH] Add public API to shallow copy instruction instances It is useful for example for easier propagation of instructions into multiple method bodies. --- Mono.Cecil.Cil/Instruction.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Mono.Cecil.Cil/Instruction.cs b/Mono.Cecil.Cil/Instruction.cs index 5fb36049b..d0d008199 100644 --- a/Mono.Cecil.Cil/Instruction.cs +++ b/Mono.Cecil.Cil/Instruction.cs @@ -59,6 +59,11 @@ internal Instruction (OpCode opcode, object operand) this.operand = operand; } + public Instruction GetPrototype () + { + return new Instruction (opcode, operand); + } + public int GetSize () { int size = opcode.Size;