Open sandboxFocus

Class StrictlyGreaterThanAttribute

Custom attribute that, when added to a field, property or parameter, throws an ArgumentOutOfRangeException if the target is assigned a value that is smaller than or equal to a given value.

Namespace: Metalama.Patterns.Contracts
Assembly: Metalama.Patterns.Contracts.dll
Syntax
public class StrictlyGreaterThanAttribute : 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 minimum value plus a tolerance value. The tolerance value is equal to the distance of the value closest to the minimum value according to the precision of the respective floating-point numerical data type.

Constructors

Name Description
StrictlyGreaterThanAttribute(byte)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type byte.

StrictlyGreaterThanAttribute(decimal)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type decimal.

StrictlyGreaterThanAttribute(double)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type double.

StrictlyGreaterThanAttribute(short)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type short.

StrictlyGreaterThanAttribute(int, int)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type int.

StrictlyGreaterThanAttribute(long, int)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type long.

StrictlyGreaterThanAttribute(sbyte)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type sbyte.

StrictlyGreaterThanAttribute(float)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type float.

StrictlyGreaterThanAttribute(ushort)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type ushort.

StrictlyGreaterThanAttribute(uint)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type uint.

StrictlyGreaterThanAttribute(ulong)

Initializes a new instance of the StrictlyGreaterThanAttribute class specifying a minimum value of type ulong.

Methods

Name Description
OnContractViolated(dynamic?, NumericRange, ContractContext)

See Also