PostSharp SDK 6.10 / / Class Reference / Post­Sharp.​Sdk.​Code­Model Namespace / Instruction­Block Class / Instruction­Block Methods / Instruction­Block.​Add­Child­Block Method

InstructionBlock.AddChildBlock Method

Adds a child block.

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 6.10.14.0 (6.10.14.0)
Syntax
C#
public InstructionBlock AddChildBlock(
	InstructionBlock newBlock = null,
	NodePosition position = NodePosition.After,
	InstructionBlock referenceBlock = null
)

Parameters

newBlock (Optional)
Type: PostSharp.Sdk.CodeModel.InstructionBlock
Block to insert.
position (Optional)
Type: NodePosition
Relative position of the new block w.r.t. referenceBlock.
referenceBlock (Optional)
Type: PostSharp.Sdk.CodeModel.InstructionBlock
Block after or before which newBlock has to be inserted, or null if the new block has to be inserted at the first or the last.

Return Value

Type: InstructionBlock
The InstructionBlock passed in the newBlock parameter, or the newly created InstructionBlock if newBlock was null.
Exceptions
ExceptionCondition
ArgumentExceptionThe newBlock instruction block is already attached.
InvalidOperationExceptionThe current block is detached or has no parent block.
See Also