Open sandboxFocus

Class GreaterThanAttribute

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 a given value.

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

Null values are accepted and do not throw an exception.

Error message is identified by GreaterThanErrorMessage.

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

Constructors

Name Description
GreaterThanAttribute(double)

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

GreaterThanAttribute(long)

Initializes a new GreaterThanAttribute with a given integer bound.

GreaterThanAttribute(ulong)

Initializes a new GreaterThanAttribute 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 {4}, {5} and so on.