PostSharp SDK 6.10 / / Class Reference / Post­Sharp.​Sdk.​Code­Model Namespace / Element Class

Element Class

Represents an element of a tree structure.
Inheritance Hierarchy

Namespace:  PostSharp.Sdk.CodeModel
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: (
public abstract class Element

The Element type exposes the following members.

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.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodNotifyChildPropertyChanged
Method invoked when a property of a child has been changed.
Protected methodOnPropertyChanged
Method invoked when a property of the current instance has been changed.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)

The CLI module is basically represented as a tree of objects what are called Declaration in PostSharp. The root of the module tree is the ModuleDeclaration. Modules are contained in assemblies (AssemblyEnvelope) and assemblies are bounded in the scope of a specified Domain.

All elements that are a part of a Domain are represented by the Element type. This class is basically a tree node. Element instances have two properties: Parent gives the direct parent, and Domain gives the root Domain.

The child-parent relationship is managed automatically when the child is related to the parent either adding it into a collection of children, either setting it as the value of a property of the parent.

See Also