PostSharpAPI ReferencePost­Sharp.​Patterns.​ContractsStrictly­Greater­Than­Attribute
Open sandboxFocus

StrictlyGreaterThanAttribute Class

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
public class StrictlyGreaterThanAttribute : RangeAttribute, ILocationLevelAspect, IValidableAnnotation, IAspect

Null values are accepted and do not throw an exception.

Floating-point values are tested to be greater than or equal to the minimum value plus a tolerance value. The tolerance value is equal to the distance of the value closest to the minimum value according to the precision of the respective floating-point numerical data type.

Error message is identified by StrictlyGreaterThanErrorMessage.

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


Name Description

Initializes a new StrictlyGreaterThanAttribute with a given floating-point bound.


Initializes a new StrictlyGreaterThanAttribute with a given integer bound.


Initializes a new StrictlyGreaterThanAttribute with a given UInt64 bound.


Name Description
CreateException(Object, String, LocationKind, LocationValidationContext)

Gets unformatted error message as defined by the instance.


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