Open sandboxFocus

Class StrictlyGreaterThanAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is smaller than or equal to a given value.

Namespace: PostSharp.Patterns.Contracts
Assembly: PostSharp.Patterns.Common.dll
Syntax
public class StrictlyGreaterThanAttribute : RangeAttribute, ILocationLevelAspect, IValidableAnnotation, IAspect
Remarks

Null values are accepted and do not throw an exception.

A floating-point or decimal value is accepted when it is greater than or equal to the least value of its type that is greater than the bound. A double bound is first converted to decimal, with 15 significant digits, to compute the decimal bound.

The error message is identified by StrictlyGreaterThanErrorMessage.

The error message can use the additional argument {4} to refer to the minimum value used.

Constructors

Name Description
StrictlyGreaterThanAttribute(double)

Initializes a new instance of the StrictlyGreaterThanAttribute class with a given floating-point bound.

StrictlyGreaterThanAttribute(long)

Initializes a new instance of the StrictlyGreaterThanAttribute class with a given integer bound.

StrictlyGreaterThanAttribute(ulong)

Initializes a new instance of the StrictlyGreaterThanAttribute class with a given ulong bound.

Methods

Name Description
CreateException(object, string, LocationKind, LocationValidationContext)
GetErrorMessage()

Gets the unformatted error message as defined by the instance.

GetErrorMessageArguments()

Gets the values of the additional arguments for the error message associated with a particular instance of LocationContractAttribute. These arguments can be referenced from the error message string by {4}, {5}, and so on.