diff --git a/Source/Meadow.Units/Temperature.cs b/Source/Meadow.Units/Temperature.cs index 3bb3e56..360f747 100644 --- a/Source/Meadow.Units/Temperature.cs +++ b/Source/Meadow.Units/Temperature.cs @@ -20,13 +20,16 @@ public struct Temperature : IComparable, IFormattable, IConvertible, IEquatable, IComparable { - public static Temperature AbsoluteZero = new Temperature(0, UnitType.Kelvin); + /// + /// Absolute Zero temperature. + /// + public static Temperature AbsoluteZero = new (0, UnitType.Kelvin); /// /// Creates a new `Temperature` object. /// /// The temperature value. - /// _Celsius_ (`C°`), by default. + /// _Celsius_ (`°C`), by default. public Temperature(double value, UnitType type = UnitType.Celsius) { Value = 0; @@ -43,11 +46,14 @@ public Temperature(double value, UnitType type = UnitType.Celsius) break; } - if (this < AbsoluteZero) throw new ArgumentOutOfRangeException(); + if (this.Kelvin < 0) + { + throw new ArgumentOutOfRangeException("Temperature cannot be less than 0 Kelvin"); + } } /// - /// Creates a new `Temperature` object from an existing Temperature object + /// Creates a new `Temperature` object from an existing Temperature object. /// /// public Temperature(Temperature temperature)