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.

Inheritance
System.Object
LessThanAttribute
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 System.Byte.

LessThanAttribute(Decimal)

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

LessThanAttribute(Double)

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

LessThanAttribute(Int16)

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

LessThanAttribute(Int32, Int32)

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

LessThanAttribute(Int64, Int32)

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

LessThanAttribute(SByte)

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

LessThanAttribute(Single)

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

LessThanAttribute(UInt16)

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

LessThanAttribute(UInt32)

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

LessThanAttribute(UInt64)

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

Methods

Name Description
OnContractViolated(Object)

See Also