DecimalRange
Defines a range of type Decimal
Constructors
public DecimalRange()
decimalRange = DecimalRange()
Initializes a new instance of the DecimalRange class.
public DecimalRange(decimal min, decimal max)
decimalRange = DecimalRange(min, max)
Initializes a new instance of the DecimalRange class.
- min
- The min value.
- max
- The max value.
Properties
public override decimal Diff { get; }
value = decimalRange.Diff
Gets the difference (Max - Min) of this range
public override bool IsZero { get; }
value = decimalRange.IsZero
Gets a value indicating whether this instance is zero.
Methods
public override DoubleRange AsDoubleRange()
result = decimalRange.AsDoubleRange()
Converts this range to a DoubleRange, which are used internally for calculations
public override IRange<decimal> ClipTo(IRange<decimal> maximumRange)
result = decimalRange.ClipTo(maximumRange)
Clips the current IRange to a maxmimum range
- maximumRange
- The Maximum Range
Returns: This instance, after the operation
public override IRange<decimal> GrowBy(double minFraction, double maxFraction)
result = decimalRange.GrowBy(minFraction, maxFraction)
Grows the current IRange by the min and max fraction, returning this instance after modification
- minFraction
- The Min fraction to grow by. For example, Min = -10 and minFraction = 0.1 will result in the new Min = -11
- maxFraction
- The Max fraction to grow by. For example, Max = 10 and minFraction = 0.2 will result in the new Max = 12
Returns: This instance, after the operation
public override IRange<decimal> SetMinMax(double min, double max)
result = decimalRange.SetMinMax(min, max)
Sets the Min, Max values on the IRange, returning this instance after modification
- min
- The new Min value.
- max
- The new Max value.
Returns: This instance, after the operation
public override IRange<decimal> SetMinMax(double min, double max, IRange<decimal> maxRange)
result = decimalRange.SetMinMax(min, max, maxRange)
Sets the Min, Max values on the IRange with a max range to clip values to, returning this instance after modification
- min
- The new Min value.
- max
- The new Max value.
- maxRange
- The max range, which is used to clip values.
Returns: This instance, after the operation