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
Syntax
[HasInheritedAttribute]
public interface ILocationValidationAspect<T> : ILocationValidationAspect, IAspect
Type Parameters
Name | Description |
---|---|
T | Type of values validated by the current aspect. |
Remarks
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.
Methods
Name | Description |
---|---|
ValidateValue(T, string, LocationKind, LocationValidationContext) | Validates the value being assigned to the location to which the current aspect has been applied. |