MetalamaAPI documentationPatterns APIMetalama.​Patterns.​ContractsLess­Than­Attribute
Open sandboxFocus

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

Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public class LessThanAttribute : RangeAttribute, IAspect<IParameter>, IEligible<IParameter>, IAspect<IFieldOrPropertyOrIndexer>, IEligible<IFieldOrPropertyOrIndexer>, IConditionallyInheritableAspect, IAspect, ICompileTimeSerializable, ITemplateProvider
Remarks

Null values are accepted and do not throw an exception.

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

Constructors

Name Description
LessThanAttribute(Byte)

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

LessThanAttribute(Decimal)

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

LessThanAttribute(Double)

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

LessThanAttribute(Int16)

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

LessThanAttribute(Int32, Int32)

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

LessThanAttribute(Int64, Int32)

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

LessThanAttribute(SByte)

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

LessThanAttribute(Single)

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

LessThanAttribute(UInt16)

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

LessThanAttribute(UInt32)

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

LessThanAttribute(UInt64)

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

Methods

Name Description
OnContractViolated(Object)

See Also