Struct ValueRange
- Namespace
- Icy.Data
- Assembly
- IcyUI.dll
The values a numeric property accepts, as declared by RangeAttribute.
public readonly record struct ValueRange : IEquatable<ValueRange>
- Implements
- Inherited Members
- Extension Methods
Remarks
An infinite bound means the range is open on that side. Infinite and NaN values are never inside a range: "open" means no limit on finite values.
Constructors
ValueRange(double, double, bool, bool)
The values a numeric property accepts, as declared by RangeAttribute.
public ValueRange(double Min, double Max, bool MinIsExclusive, bool MaxIsExclusive)
Parameters
MindoubleThe lower bound; NegativeInfinity for none.
MaxdoubleThe upper bound; PositiveInfinity for none.
MinIsExclusiveboolWhether
Minitself is outside the range.MaxIsExclusiveboolWhether
Maxitself is outside the range.
Remarks
An infinite bound means the range is open on that side. Infinite and NaN values are never inside a range: "open" means no limit on finite values.
Properties
IsBounded
Gets a value indicating whether the range can drive a slider: both bounds are finite, and the span between them stays finite in float, which Slider works in.
public bool IsBounded { get; }
Property Value
Remarks
A range such as [Range(0, double.MaxValue)] has finite bounds but isn't bounded in this sense: its maximum
becomes PositiveInfinity as a float.
Max
The upper bound; PositiveInfinity for none.
public double Max { get; init; }
Property Value
MaxIsExclusive
Whether Max itself is outside the range.
public bool MaxIsExclusive { get; init; }
Property Value
Min
The lower bound; NegativeInfinity for none.
public double Min { get; init; }
Property Value
MinIsExclusive
Whether Min itself is outside the range.
public bool MinIsExclusive { get; init; }
Property Value
Methods
Contains(double)
Determines whether value is inside the range.
public bool Contains(double value)
Parameters
valuedoubleThe value to check.
Returns
Describe()
Describes the range as a user-facing rule, such as "Must be greater than 0.".
public string Describe()
Returns
- string
An English sentence with numbers in the invariant culture.