Represents an advice that imports a field or property (represented by a LocationInfo) of the target class into a field of the aspect class. This class is the imperative equivalent of the ImportMemberAttribute declarative advice.
Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
public sealed class ImportLocationAdviceInstance : ImportMemberAdviceInstanceRemarks
Return instances of this class from ProvideAdvices(object). Unlike ImportMemberAttribute, this advice can import several fields or properties into a single aspect field: declare the field as a collection of ILocationBinding, as described in the ImportLocationAdviceInstance(FieldInfo, LocationInfo) constructor, and return one advice per field or property.
Constructors
| Name | Description |
|---|---|
| ImportLocationAdviceInstance(FieldInfo, LocationInfo) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies which field or property should be imported by giving its reflection representation. |
| ImportLocationAdviceInstance(FieldInfo, string, bool, ImportMemberOrder) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported. The type of this property is matched according to the type of the aspect field. |
| ImportLocationAdviceInstance(FieldInfo, string[], bool, ImportMemberOrder) | Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported. The type of this property is matched according to the type of the aspect field. |
Properties
| Name | Description |
|---|---|
| Location | Gets the field or property of the target class that needs to be imported into the aspect. |
| Member | Gets the reflection object (LocationInfo or MethodInfo) that needs to be
imported, or |
| MemberNames | Gets the fallback list of possible names of the member to be imported. |