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, Method­Mapping, Local­Variable­Symbol)

MethodBodyTransformationContext.AddRedirection Method (InstructionBlock, InstructionSequence, MethodMapping, LocalVariableSymbol)

Adds a MethodBodyTransformationRedirection by specifying an instruction block (typically in a different method) in which the next transformation should add its implementation, a different method mapping and a 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,
	MethodMapping methodMapping,
	LocalVariableSymbol returnVariable
)

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.
methodMapping
Type: PostSharp.Sdk.AspectInfrastructure.MethodMapping
The method mapping for the new instructionBlock, or null if the method mapping is not modified.
returnVariable
Type: PostSharp.Sdk.CodeModel.LocalVariableSymbol
The variable in which the next transformation should store the return value, or null if the return variable is not modified.

Return Value

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