PostSharpAPI ReferencePost­Sharp.​AspectsILocation­Validation­Aspect<T>
Open sandboxFocus

ILocationValidationAspect<T> Interface

Runtime semantics of an aspect that, when applied on a location (field, property, or parameter), validates the value assigned to this location using method ValidateValue(T, String, LocationKind, LocationValidationContext), and throws the exception returned by this method if any.

Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
public interface ILocationValidationAspect<T> : ILocationValidationAspect, IAspect
Type Parameters
Name Description

Type of values validated by the current aspect.


An aspect will typically implement several generic instances of the current interface, with different values of T. The aspect can be applied only to locations for which there is an exact type match. PostSharp does not implement any type conversion, even when this conversion is implicitly supported by the compiler, for instance int to long. Therefore, if your aspect must be able to validate all integers, you may need to implement the interface instances for T ranging in long, int, short, sbyte and possibly their unsigned variant. However, values of a derived type can be validated if T is the base type.


Name Description
ValidateValue(T, String, LocationKind, LocationValidationContext)

Validates the value being assigned to the location to which the current aspect has been applied.

See Also