Table of Contents

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

Min double

The lower bound; NegativeInfinity for none.

Max double

The upper bound; PositiveInfinity for none.

MinIsExclusive bool

Whether Min itself is outside the range.

MaxIsExclusive bool

Whether Max itself 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

bool

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

double

MaxIsExclusive

Whether Max itself is outside the range.

public bool MaxIsExclusive { get; init; }

Property Value

bool

Min

The lower bound; NegativeInfinity for none.

public double Min { get; init; }

Property Value

double

MinIsExclusive

Whether Min itself is outside the range.

public bool MinIsExclusive { get; init; }

Property Value

bool

Methods

Contains(double)

Determines whether value is inside the range.

public bool Contains(double value)

Parameters

value double

The value to check.

Returns

bool

true when the value is finite and satisfies both bounds.

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.