Open sandboxFocus

Class LessThanOrEqualAttribute

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 LessThanOrEqualAttribute : 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
LessThanOrEqualAttribute(byte)

Initializes a new instance of the LessThanOrEqualAttribute class specifying a maximum value of type byte.

LessThanOrEqualAttribute(decimal)

Initializes a new instance of the LessThanOrEqualAttribute class specifying a maximum value of type decimal.

LessThanOrEqualAttribute(double)

Initializes a new instance of the LessThanOrEqualAttribute class specifying a maximum value of type double.

LessThanOrEqualAttribute(short)

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

LessThanOrEqualAttribute(int, int)

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

LessThanOrEqualAttribute(long, int)

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

LessThanOrEqualAttribute(sbyte)

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

LessThanOrEqualAttribute(float)

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

LessThanOrEqualAttribute(ushort)

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

LessThanOrEqualAttribute(uint)

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

LessThanOrEqualAttribute(ulong)

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

Methods

Name Description
OnContractViolated(dynamic?, NumericRange, ContractContext)

See Also