PostSharpAPI ReferencePost­Sharp.​AspectsEvent­Level­AspectCompile­Time­Validate
Open sandboxFocus

EventLevelAspect.CompileTimeValidate Method

CompileTimeValidate(EventInfo)

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

Declaration
public virtual bool CompileTimeValidate(EventInfo targetEvent)
Parameters
Type Name Description
System.Reflection.EventInfo targetEvent

Event to which the aspect has been applied

Returns
Type Description
System.Boolean

true if the aspect was applied to an acceptable event, otherwise false.

Remarks

The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.

See Also

CompileTimeValidate(Object)

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

Declaration
public sealed override bool CompileTimeValidate(object target)
Parameters
Type Name Description
System.Object target

Code element (Assembly, System.Type, FieldInfo, System.Reflection.MethodBase, System.Reflection.PropertyInfo, System.Reflection.EventInfo, System.Reflection.ParameterInfo, or LocationInfo) to which the aspect has been applied.

Returns
Type Description
System.Boolean

true if the aspect was applied to an acceptable target, otherwise false.

Overrides
Aspect.CompileTimeValidate(Object)
Implements
IValidableAnnotation.CompileTimeValidate(Object)
Remarks

The implementation of this method is expected to emit an error message (see MessageSource) or an exception in case of error. Returning false without emitting an error message or exception causes the aspect to be silently ignored.

See Also