/// <summary> /// Rewrites an existing method. /// </summary> /// <param name="method">The method that needs to be modified.</param> private void Rewrite(MethodDefinition method) { MethodBody body = method.Body; CilWorker IL = body.CilWorker; IEnumerable <Instruction> oldInstructions = _instructionProvider.GetInstructions(method); body.Instructions.Clear(); _rewriter.AddLocals(method); _rewriter.Rewrite(method, IL, oldInstructions); }
/// <summary> /// Rewrites an existing method. /// </summary> /// <param name="method">The method that needs to be modified.</param> private void Rewrite(MethodDefinition method) { var body = method.Body; var IL = body.GetILProcessor(); var oldInstructions = _instructionProvider.GetInstructions(method); body.Instructions.Clear(); _rewriter.AddLocals(method); _rewriter.Rewrite(method, IL, oldInstructions); }