Open sandboxFocus

Class AspectInstance

Completely specifies an aspect instance, including its target code element. An AspectInstance contains either the aspect instance itself (Aspect property), or the information needed to construct the aspect (AspectConstruction) and to configure the weaver (AspectConfiguration).

Inheritance
AspectInstance
Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
Syntax
public sealed class AspectInstance : AspectSpecification
Remarks

Instances of this class are returned by ProvideAspects(object) to add aspects to declarations programmatically, at build time.

Constructors

Name Description
AspectInstance(object, IAspect)

Initializes a new instance of the AspectInstance class from a runtime aspect instance (IAspect).

AspectInstance(object, IAspect, AspectConfiguration)

Initializes a new instance of the AspectInstance class from a runtime aspect instance (IAspect) and its AspectConfiguration.

AspectInstance(object, ObjectConstruction)

Initializes a new instance of the AspectInstance class from an ObjectConstruction.

AspectInstance(object, ObjectConstruction, AspectConfiguration)

Initializes a new instance of the AspectInstance class from an ObjectConstruction and an AspectConfiguration object.

Properties

Name Description
RepresentAsStandalone

Gets or sets a value indicating whether the AspectInstance should be represented as a standalone instance in PostSharp Tools for Visual Studio. If false, the current AspectInstance will not be represented as a standalone node, and its advices will be merged with the ones provided by the parent aspect (implementing IAspectProvider). The default value is false.

TargetElement

Gets the code element (Assembly, Type, FieldInfo, MethodBase, PropertyInfo, EventInfo, ParameterInfo, or LocationInfo) to which the current AspectInstance is applied.

See Also