PostSharp SDK6.6//Post­Sharp.​Sdk.​Code­Model Namespace/Instruction­Block Class

InstructionBlock Class

A single node of the hierarchical structure of a method body.
Inheritance Hierarchy
System.Object
  PostSharp.Sdk.CodeModel.Element
    PostSharp.Sdk.CodeModel.InstructionBlock

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 6.6.3.0 (6.6.3.0)
Syntax
C#
public sealed class InstructionBlock : Element, 
	IBlockExpression, IExpression, IMethodBodyElement, IReadOnlyLinkedList<IBlockExpression>, 
	IReadOnlyLinkedList<IExceptionHandler>, ILinkedListNode<IBlockExpression>, ICustomDebuggingInformationOwner

The InstructionBlock type exposes the following members.

Properties
  NameDescription
Public propertyComment
Gets or sets the comment associated to the current block.
Public propertyCustomDebuggingInformation
Public propertyExceptionHandlerKind
Public propertyHasChildrenBlocks
Determines whether the current block has children blocks.
Public propertyHasExceptionHandlers
Determines whether the current block has exception handlers (ExceptionHandler).
Public propertyHasInstructionSequences
Determines whether the current block has instruction sequences (InstructionSequence).
Public propertyHasLocalConstantSymbols
Public propertyHasLocalVariableSymbols
Determines whether the current block has local variable symbols (LocalVariableSymbol).
Public propertyHasStateMachineFields
Public propertyIsExceptionHandler
Determines whether the current block is a direct child of an exception handler (i.e. is a handler or filter block).
Public propertyIsProtected
Determines whether the current block is protected (directly or indirectly) by an exception handler.
Public propertyLocalConstantSymbolCount
Public propertyLocalVariableAssignments
Public propertyLocalVariableSymbolCount
Gets the number of local variable symbols (LocalVariableSymbol).
Public propertyPrecedessors
Public propertyStateMachineFields
Public propertySuccessors
Public propertyToken
Gets the instruction sequence token.
Methods
  NameDescription
Public methodAddChildBlock
Adds a child block.
Public methodAddExceptionHandlerCatch
Constructs an catchExceptionHandler and add it to the current block.
Public methodAddExceptionHandlerFault
Constructs a FaultExceptionHandler and add it to the current block.
Public methodAddExceptionHandlerFilter
Constructs a FilterExceptionHandler and add it to the current block.
Public methodAddExceptionHandlerFinally
Constructs a finallyExceptionHandler and add it to the current block.
Public methodAddInstructionSequence
Adds an InstructionSequence after a given sequence in the current the block.
Public methodAddLocalConstantSymbol
Public methodAddLocalVariableSymbol
Adds a LocalVariableSymbol to the current InstructionBlock.
Public methodClearCache
Clear the cache (typically mapping to System.Reflection or, if the current element is a reference, to the related definition) of the current Element and all its children.
(Inherited from Element.)
Public methodDefineLocalVariable(ITypeSignature, CommonString)
Creates a new local variable in the current block.
Public methodDefineLocalVariable(ITypeSignature, String)
Creates a new local variable in the current block.
Public methodDelete
Public methodDetach
Detaches the current block from its parent.
Public methodDispose Obsolete.
Releases all resources used by the InstructionBlock
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodStatic memberFindCommonAncestor
Finds the deepest common ancestor of two blocks in the method body tree.
Public methodFindFirstInstructionSequence
Finds the first InstructionSequence of the tree whose current InstructionBlock is the root.
Public methodFindLastInstructionSequence
Public methodGetChildrenEnumerator()
Gets an enumerator to enumerate children blocks
Public methodGetChildrenEnumerator(Boolean)
Gets an enumerator to enumerate children blocks and allow to enumerate them children of children recursively.
Public methodGetChildrenEnumerator(Boolean, Boolean)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLocalConstantSymbol
Public methodGetLocalVariableSymbol
Gets a LocalVariableSymbol given its position in the current block.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodMoveInstructionBlock
Moves an InstructionBlock from another block into the current one.
Public methodMoveInstructionSequence
Adds an InstructionSequence after a given sequence in the current the block.
Public methodNest()
Inserts a new InstructionBlock between the current block and its parent.
Public methodNest(Boolean)
Public methodNest(Boolean, Boolean)
Inserts a new InstructionBlock between the current block and its parent.
Public methodSplitBlockAfterSequence
Splits the current InstructionBlock in two blocks after an InstructionSequence.
Public methodToString
Returns a string that represents the current object.
(Overrides Object.ToString().)
Extension Methods
Remarks
A method body (MethodBodyDeclaration) is represented as a tree of instruction blocks. Lexical scopes (definition of local variable symbols) and exception handlers are defined at InstructionBlock level. Instruction blocks may contain either children blocks or instruction sequences (InstructionSequence). Independently, every InstructionBlock can contain exception handlers and local variable symbols.
See Also