Click or drag to resize

TemperatureUnitRange Method

Returns a non-null low-to-high-sorted ICollection of temperatures, with values running from firstValue to lastValue (inclusive), and the specified step between each consecutive temperature.

Namespace: DegreeDays.Api.Data
Assembly: DegreeDays (in DegreeDays.dll) Version: 1.4
Syntax
public ICollection<Temperature> Range(
	double firstValue,
	double lastValue,
	double step
)

Parameters

firstValue  Double
The value of the first Temperature to be included in the returned ICollection. If this Range method is called on Celsius, firstValue must be greater than or equal to -273°C and less than or equal to 3000°C; if it is called on Fahrenheit then firstValue must be greater than or equal to -459.4°F and less than or equal to 5432°F.
lastValue  Double
The value of the last Temperature to be included in the returned ICollection. This must be greater than or equal to firstValue. Also, like for firstValue, if this Range method is called on Celsius, lastValue must be greater than or equal to -273°C and less than or equal to 3000°C; if it is called on Fahrenheit then lastValue must be greater than or equal to -459.4°F and less than or equal to 5432°F.
step  Double
The temperature difference between each temperature value to be included in the returned ICollection. Cannot be NaN, and must be greater than zero. It must also be a multiple of 0.1 (the smallest temperature difference allowed), though allowances are made for floating-point imprecision (so for example a step of 0.4999999 will be treated as 0.5).

Return Value

ICollectionTemperature
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionAny of the parameters are NaN; if firstValue or lastValue are outside of their allowed range (that's -273°C to 3000°C inclusive if this Range method is called on Celsius, and -459.4°F to 5432°F inclusive if it is called on Fahrenheit); if lastValue is less than firstValue; if step is not positive; or if step is not a multiple of 0.1 (allowing for slight deviations caused by floating-point imprecision).
Remarks

For example, to get Celsius temperatures between 10°C and 30°C (inclusive), with each temperature being 5°C greater than the last (giving temperatures 10°C, 15°C, 20°C, 25°C, and 30°C):

ICollection<Temperature> temps = Temperature.Celsius.Range(10, 30, 5);
Version History
VersionDescription
1.4 This was added in version 1.4.
See Also