PostSharpAPI ReferencePost­Sharp.​AspectsField­Level­Aspect
Open sandboxFocus

FieldLevelAspect Class

Base class for all aspects applied on fields.

Inheritance
FieldLevelAspect
Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
Syntax
[Serializer]
public abstract class FieldLevelAspect : Aspect, IFieldLevelAspect, IAspect, IFieldLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation
Remarks

note

Consider deriving your aspects from LocationLevelAspect; locations can abstract both fields and properties, making it possible to apply the same aspect to both.

note

This class does not provide any advice. You may derive your aspect class from a , or build a Developing Composite Aspects .

Developing Composite Aspects

note

All classes implementing IAspect should typically be marked as serializable using the SerializableAttribute or PSerializableAttribute custom attribute . Fields that are only used at runtime (and unknown at compile-time) should be carefully marked with the NonSerializedAttribute or PNonSerializedAttribute custom attribute. When PostSharp is used on a platform that does not support aspect serialization (such as .NET Compact Framework, Silverlight, or Windows Phone), or when another aspect serializer is used, it is not necessary to mark the aspect class as serializable. For more information, see Understanding Aspect Serialization .

Understanding Aspect Serialization

Constructors

Name Description
FieldLevelAspect()

Methods

Name Description
CompileTimeInitialize(FieldInfo, AspectInfo)

Method invoked at build time to initialize the instance fields of the current aspect. This method is invoked before any other build-time method.

CompileTimeValidate(Object)

Method invoked at build time to ensure that the aspect has been applied to the right target.

CompileTimeValidate(FieldInfo)

Method invoked at build time to ensure that the aspect has been applied to the right target.

RuntimeInitialize(FieldInfo)

Method invoked at runtime before any other method of the aspect is invoked.

SetAspectConfiguration(AspectConfiguration, Object)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

SetAspectConfiguration(AspectConfiguration, FieldInfo)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.

See Also