PostSharp 2023.0 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Aspects Namespace / ILocation­Validation­Aspect(T) Interface

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 (in PostSharp.dll) Version: 2023.0.3.0 (2023.0.3.0)
public interface ILocationValidationAspect<T> : ILocationValidationAspect, 

Type Parameters

Type of values validated by the current aspect.

The ILocationValidationAspect<T> type exposes the following members.

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

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.

See Also