PostSharp SDK 2023.0 / / Class Reference / Post­Sharp.​Sdk.​Aspect­Infrastructure Namespace / Method­Body­Transformation­Context Class / Method­Body­Transformation­Context Methods / Method­Body­Transformation­Context.​Add­Redirection Method / Method­Body­Transformation­Context.​Add­Redirection Method (Instruction­Block, Instruction­Sequence)

MethodBodyTransformationContext.AddRedirection Method (InstructionBlock, InstructionSequence)

Adds a MethodBodyTransformationRedirection by specifying an instruction block (inside the current method) in which the next transformation should add its implementation, but without changing the method mapping or the local variable storing the return value.

Namespace:  PostSharp.Sdk.AspectInfrastructure
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 2023.0.3.0 (2023.0.3.0)
Syntax
C#
public MethodBodyTransformationRedirection AddRedirection(
	InstructionBlock instructionBlock,
	InstructionSequence leaveBranchTarget
)

Parameters

instructionBlock
Type: PostSharp.Sdk.CodeModel.InstructionBlock
Instruction block in which the next transformation should be implemented, or null if the instruction block is not modified.
leaveBranchTarget
Type: PostSharp.Sdk.CodeModel.InstructionSequence
Instruction sequence to which the next transformation should go to when existing (instead of emitting the ret instruction), or null if the leave target is not modified.

Return Value

Type: MethodBodyTransformationRedirection
The MethodBodyTransformationRedirection that has been created.
See Also