PostSharpAPI ReferencePost­Sharp.​Patterns.​ContractsStrict­Range­Attribute
Open sandboxFocus

Class StrictRangeAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is not strictly within the given range.

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

Constructors

Name Description
StrictRangeAttribute(Double, Double)

Initializes a new StrictRangeAttribute with given floating-point bounds.

StrictRangeAttribute(Int64, Int64)

Initializes a new StrictRangeAttribute with given integer bounds.

StrictRangeAttribute(UInt64, UInt64)

Initializes a new StrictRangeAttribute with given UInt64 bounds.

Methods

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

Gets unformatted error message as defined by the instance.