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

ImportMethodAdviceInstance Constructor

ImportMethodAdviceInstance(FieldInfo, String, Boolean, ImportMemberOrder)

Initializes a new instance of the ImportMethodAdviceInstance.

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

A field of the aspect class into that will be assigned to a delegate of the imported method at runtime. The field type should be a delegate of the same signature than the method to import.

System.String methodName

Name of the method to import.

Boolean isRequired

true if the build should fail if there no matching method in the target class, false to set aspectField to null in this case.

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.

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

Initializes a new instance of the ImportMethodAdviceInstance.

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

A field of the aspect class into that will be assigned to a delegate of the imported method at runtime. The field type should be a delegate of the same signature than the method to import.

System.String[] methodNames

Fallback list of possible names of the member to be imported.

Boolean isRequired

true if the build should fail if there no matching method in the target class, false to set aspectField to null in this case.

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.