MetalamaAPI documentationPatterns APIMetalama.​Patterns.​ContractsStrictly­Less­Than­Attribute
Open sandboxFocus

StrictlyLessThanAttribute Class

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.

Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public class StrictlyLessThanAttribute : RangeAttribute, IAspect<IParameter>, IEligible<IParameter>, IAspect<IFieldOrPropertyOrIndexer>, IEligible<IFieldOrPropertyOrIndexer>, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider
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.

Constructors

Name Description
StrictlyLessThanAttribute(Byte)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type Byte.

StrictlyLessThanAttribute(Decimal)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type Decimal.

StrictlyLessThanAttribute(Double)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type Double.

StrictlyLessThanAttribute(Int16)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type Int16.

StrictlyLessThanAttribute(Int32, Int32)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type Int32.

StrictlyLessThanAttribute(Int64, Int32)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type Int64.

StrictlyLessThanAttribute(SByte)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type SByte.

StrictlyLessThanAttribute(Single)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type Single.

StrictlyLessThanAttribute(UInt16)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type UInt16.

StrictlyLessThanAttribute(UInt32)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type UInt32.

StrictlyLessThanAttribute(UInt64)

Initializes a new instance of the StrictlyLessThanAttribute class specifying a maximum value of type UInt64.

Methods

Name Description
OnContractViolated(Object)

See Also