MetalamaAPI documentationPatterns APIMetalama.​Patterns.​ContractsRange­AttributeRange­Attribute
Open sandboxFocus

RangeAttribute Constructor

RangeAttribute(Int64, Int64, Boolean, Boolean, Int32)

Initializes a new instance of the RangeAttribute class specifying bounds of type Int64.

Declaration
public RangeAttribute(long min, long max, bool minAllowed = true, bool maxAllowed = true, int decimalPlaces = 0)
Parameters
Type Name Description
Int64 min

The minimum value.

Int64 max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

Int32 decimalPlaces

When non-zero, interprets the min and max numbers as Decimal instead of Int64 by adding a decimal point at the specified position. For instance, if min is set to 1234 and decimalPlaces is set to 3, the min parameter will be reinterpreted as 1.234m.

RangeAttribute(UInt64, UInt64, Boolean, Boolean)

Initializes a new instance of the RangeAttribute class specifying bounds of type UInt64.

Declaration
public RangeAttribute(ulong min, ulong max, bool minAllowed = true, bool maxAllowed = true)
Parameters
Type Name Description
UInt64 min

The minimum value.

UInt64 max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

RangeAttribute(Double, Double, Boolean, Boolean)

Initializes a new instance of the RangeAttribute class specifying bounds of type Double.

Declaration
public RangeAttribute(double min, double max, bool minAllowed = true, bool maxAllowed = true)
Parameters
Type Name Description
Double min

The minimum value.

Double max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

RangeAttribute(Single, Single, Boolean, Boolean)

Initializes a new instance of the RangeAttribute class specifying bounds of type Single.

Declaration
public RangeAttribute(float min, float max, bool minAllowed = true, bool maxAllowed = true)
Parameters
Type Name Description
Single min

The minimum value.

Single max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

RangeAttribute(Int32, Int32, Boolean, Boolean, Int32)

Initializes a new instance of the RangeAttribute class specifying bounds of type Int32.

Declaration
public RangeAttribute(int min, int max, bool minAllowed = true, bool maxAllowed = true, int decimalPlaces = 0)
Parameters
Type Name Description
Int32 min

The minimum value.

Int32 max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

Int32 decimalPlaces

When non-zero, interprets the min and max numbers as Decimal instead of Int64 by adding a decimal point at the specified position. For instance, if min is set to 1234 and decimalPlaces is set to 3, the min parameter will be reinterpreted as 1.234m.

RangeAttribute(UInt32, UInt32, Boolean, Boolean)

Initializes a new instance of the RangeAttribute class specifying bounds of type UInt32.

Declaration
public RangeAttribute(uint min, uint max, bool minAllowed = true, bool maxAllowed = true)
Parameters
Type Name Description
UInt32 min

The minimum value.

UInt32 max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

RangeAttribute(Byte, SByte, Boolean, Boolean)

Initializes a new instance of the RangeAttribute class specifying bounds of type Byte.

Declaration
public RangeAttribute(byte min, sbyte max, bool minAllowed = true, bool maxAllowed = true)
Parameters
Type Name Description
Byte min

The minimum value.

SByte max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

RangeAttribute(Int16, Int16, Boolean, Boolean)

Initializes a new instance of the RangeAttribute class specifying bounds of type Int16.

Declaration
public RangeAttribute(short min, short max, bool minAllowed = true, bool maxAllowed = true)
Parameters
Type Name Description
Int16 min

The minimum value.

Int16 max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.

RangeAttribute(UInt16, UInt16, Boolean, Boolean)

Initializes a new instance of the RangeAttribute class specifying bounds of type UInt16.

Declaration
public RangeAttribute(ushort min, ushort max, bool minAllowed = true, bool maxAllowed = true)
Parameters
Type Name Description
UInt16 min

The minimum value.

UInt16 max

The maximum value.

Boolean minAllowed

Determines if the min value is allowed (i.e. if the inequality is >= instead of >.

Boolean maxAllowed

Determines if the max value is allowed (i.e. if the inequality is <= instead of <.