Open sandboxFocus

Enum IntroduceFieldCompatibleAction

Specifies what an IntroduceFieldAdviceInstance does when the target type already has a field that is compatible with it.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
public enum IntroduceFieldCompatibleAction
Remarks

A field is compatible when it has the requested name, or the type of the request when no name is requested, and when it has exactly the type of the request and the same static or instance kind. The candidates are the fields of the target type, the fields introduced by earlier requests, and the fields of the base types that the target type can access. A member that has the requested name but is not compatible is handled by WhenIncompatibleMemberExists.

Fields

Name Description
Fail

The build fails with the error LA0271.

Ignore

The introduction is skipped: the request resolves to the compatible field, which the advices of the aspect import. This is how several aspects share one field. The request does not initialize the field.

IntroduceAnother

A new field is introduced next to the compatible field. It gets the requested name followed by a number that makes it unique in the type, such as handlers2, or, without a requested name, a generated name.

See Also