PostSharpAPI ReferencePost­Sharp.​AspectsAspect­InstanceAspect­Instance
Open sandboxFocus

AspectInstance Constructor

AspectInstance(Object, IAspect)

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

Declaration
public AspectInstance(object targetElement, IAspect aspect)
Parameters
Type Name Description
Object targetElement

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

IAspect aspect

The aspect runtime instance.

AspectInstance(Object, IAspect, AspectConfiguration)

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

Declaration
public AspectInstance(object targetElement, IAspect aspect, AspectConfiguration aspectConfiguration)
Parameters
Type Name Description
Object targetElement

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

IAspect aspect

The aspect runtime instance.

AspectConfiguration aspectConfiguration

The aspect configuration (the type of this parameter should be equal to the type configuration objects expected by the concrete aspect).

AspectInstance(Object, ObjectConstruction)

Initializes a new AspectInstance from an ObjectConstruction.

Declaration
public AspectInstance(object targetElement, ObjectConstruction aspectConstruction)
Parameters
Type Name Description
Object targetElement

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

ObjectConstruction aspectConstruction

An ObjectConstruction instructing how the aspect instance should be constructed.

AspectInstance(Object, ObjectConstruction, AspectConfiguration)

Initializes a new AspectInstance from an ObjectConstruction and specifies an AspectConfiguration object.

Declaration
public AspectInstance(object targetElement, ObjectConstruction aspectConstruction, AspectConfiguration aspectConfiguration)
Parameters
Type Name Description
Object targetElement

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

ObjectConstruction aspectConstruction

An ObjectConstruction instructing how the aspect instance should be constructed.

AspectConfiguration aspectConfiguration

An optional configuration object whose type corresponds to the aspect type.