Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is greater than or equal to a given value.
Inheritance
Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class StrictlyLessThanAttribute : RangeAttribute, ILocationLevelAspect, IValidableAnnotation, IAspect
Remarks
Null values are accepted and do not throw an exception.
Floating-point values are tested to be greater than or equal to the maximum value plus a tolerance value. The tolerance value is equal to the distance of the value closest to the maximum value according to the precision of the respective floating-point numerical data type.
Error message is identified by StrictlyLessThanErrorMessage.
Error message can use additional argument
Constructors
Name | Description |
---|---|
StrictlyLessThanAttribute(double) | Initializes a new StrictlyLessThanAttribute with a given floating-point bound. |
StrictlyLessThanAttribute(long) | Initializes a new StrictlyLessThanAttribute with a given integer bound. |
StrictlyLessThanAttribute(ulong) | Initializes a new StrictlyLessThanAttribute with a given ulong bound. |
Methods
Name | Description |
---|---|
CreateException(object, string, LocationKind, LocationValidationContext) | |
GetErrorMessage() | Gets unformatted error message as defined by the instance. |
GetErrorMessageArguments() | Gets values of additional arguments for error message associated with particular instance of LocationContractAttribute.
There arguments can be referenced from error message string by |