PostSharpAPI ReferencePost­Sharp.​Aspects.​AdvicesImport­Location­Advice­InstanceImport­Location­Advice­Instance
Open sandboxFocus

ImportLocationAdviceInstance Constructor

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.

Declaration
public ImportLocationAdviceInstance(FieldInfo aspectField, LocationInfo location)
Parameters
Type Name Description
System.Reflection.FieldInfo aspectField

A field of the aspect class to which location should be bound at runtime. This field can be of type ILocationBinding, Property<TValue>, or a type that is both (a) derived from ICollection<ILocationBinding> and (b) has a parameterless constructor.

LocationInfo location

The field or property to import.

ImportLocationAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder)

Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.

Declaration
public ImportLocationAdviceInstance(FieldInfo aspectField, string propertyName, bool isRequired = false, ImportMemberOrder order)
Parameters
Type Name Description
System.Reflection.FieldInfo aspectField

A field of the aspect class to which the field or property should be bound at build time. This field must be of type Property<TValue>.

System.String propertyName

The name of the property to import.

Boolean isRequired

Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent.

ImportMemberOrder order

Determines whether the aspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.

ImportLocationAdviceInstance(FieldInfo, String[], Boolean, ImportMemberOrder)

Initializes a new instance of the ImportLocationAdviceInstance class and specifies the name of the property to be imported; the type of this property will be matched according to the type of the aspect field.

Declaration
public ImportLocationAdviceInstance(FieldInfo aspectField, string[] propertyNames, bool isRequired = false, ImportMemberOrder order)
Parameters
Type Name Description
System.Reflection.FieldInfo aspectField

A field of the aspect class to which the field or property should be bound at build time. This field must be of type Property<TValue>.

System.String[] propertyNames

Fallback list of possible names of the property to import.

Boolean isRequired

Determines whether a build-time error should be emitted if the member cannot be found. If false, the binding field will be null in case the imported member is absent.

ImportMemberOrder order

Determines whether the aspectField should be bound to the member as resolved before or after introduction of new members into the target class by the current advise.