Open sandboxFocus

Class StrictlyLessThanAttribute

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(short)

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

StrictlyLessThanAttribute(int, int)

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

StrictlyLessThanAttribute(long, int)

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

StrictlyLessThanAttribute(sbyte)

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

StrictlyLessThanAttribute(float)

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

StrictlyLessThanAttribute(ushort)

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

StrictlyLessThanAttribute(uint)

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

StrictlyLessThanAttribute(ulong)

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

Methods

Name Description
OnContractViolated(dynamic?, NumericRange, ContractContext)

Extension Methods

See Also