ImportMemberAttribute Class |

System.Attribute
PostSharp.Aspects.Advices.Advice
PostSharp.Aspects.Advices.ImportMemberAttribute
Assembly: PostSharp (in PostSharp.dll) Version: 4.3.48.0 (4.3.48.0)

public sealed class ImportMemberAttribute : Advice
The ImportMemberAttribute type exposes the following members.

Name | Description | |
---|---|---|
![]() | ImportMemberAttribute() |
Initializes a new ImportMemberAttribute.
|
![]() | ImportMemberAttribute(String) | Initializes a new instance of the ImportMemberAttribute class |
![]() | ImportMemberAttribute(String[]) |
Initializes a new ImportMemberAttribute.
|

Name | Description | |
---|---|---|
![]() | Description |
A human-readable description of the current advice.
(Inherited from Advice.) |
![]() | IsRequired |
Determines whether a build time error must be issued if the member to be
imported is absent. If false, the binding field will be null
in case the imported member is absent.
|
![]() | LinesOfCodeAvoided |
Reduction in the code lines count achieved by applying the advice instance to one code element.
(Inherited from Advice.) |
![]() | MemberName | Obsolete.
Name of the imported member.
|
![]() | MemberNames |
Array of possible names of imported member in the order of precedence.
|
![]() | Order |
Determines when the member should be imported: either before (BeforeIntroductions)
or after (AfterIntroductions) members have been introduced by the current aspect.
Default is BeforeIntroductions.
|

Name | Description | |
---|---|---|
![]() | QueryInterface<T> |
Gets the implementation of a specified interface for the specified object.
(Defined by QueryInterfaceExtensions.) |

Fields annotated with the ImportMemberAttribute custom attribute must be public and must not be read only.
At runtime, these fields are assigned to a delegate (in case of method binding) or a pair of delegates (in case of event or property binding) allowing to invoke the imported member.
When IsRequired property is set to true and the target type does not contain a member of the required name and signature, then a build error will be raised.
When multiple member names are specified, the first existing member satisfying all conditions is used.
