diff --git a/Source/Meadow.Units/Angle.cs b/Source/Meadow.Units/Angle.cs index e5fc443..b2680d2 100644 --- a/Source/Meadow.Units/Angle.cs +++ b/Source/Meadow.Units/Angle.cs @@ -17,6 +17,18 @@ public struct Angle : IComparable, IFormattable, IConvertible, IEquatable, IComparable { + private static Angle _zero; + + static Angle() + { + _zero = new Angle(0, UnitType.Degrees); + } + + /// + /// Gets an angle with a value of zero + /// + public static Angle Zero => _zero; + /// /// Creates a new `Angle` object. /// @@ -24,7 +36,7 @@ public struct Angle : /// Degrees by default. public Angle(double value, UnitType type = UnitType.Degrees) { - Value = AngleConversions.Convert(value, type, UnitType.Degrees); + _value = AngleConversions.Convert(value, type, UnitType.Degrees); } /// @@ -33,13 +45,13 @@ public Angle(double value, UnitType type = UnitType.Degrees) /// public Angle(Angle angle) { - Value = angle.Value; + _value = angle._value; } /// /// Internal canonical value. /// - private readonly double Value; + private readonly double _value; /// /// The type of units available to describe the Angle. @@ -110,7 +122,7 @@ public enum UnitType [Pure] public double From(UnitType convertTo) { - return AngleConversions.Convert(Value, UnitType.Degrees, convertTo); + return AngleConversions.Convert(_value, UnitType.Degrees, convertTo); } /// @@ -130,7 +142,7 @@ public override bool Equals(object obj) /// Get hash of object /// /// int32 hash value - [Pure] public override int GetHashCode() => Value.GetHashCode(); + [Pure] public override int GetHashCode() => _value.GetHashCode(); // implicit conversions //[Pure] public static implicit operator Angle(ushort value) => new Angle(value); @@ -148,7 +160,7 @@ public override bool Equals(object obj) /// /// The object to compare /// true if equal - [Pure] public bool Equals(Angle other) => Value == other.Value; + [Pure] public bool Equals(Angle other) => _value == other._value; /// /// Equals operator to compare two Angle objects @@ -156,7 +168,7 @@ public override bool Equals(object obj) /// left value /// right value /// true if equal - [Pure] public static bool operator ==(Angle left, Angle right) => Equals(left.Value, right.Value); + [Pure] public static bool operator ==(Angle left, Angle right) => Equals(left._value, right._value); /// /// Not equals operator to compare two Angle objects @@ -164,14 +176,14 @@ public override bool Equals(object obj) /// left value /// right value /// true if not equal - [Pure] public static bool operator !=(Angle left, Angle right) => !Equals(left.Value, right.Value); + [Pure] public static bool operator !=(Angle left, Angle right) => !Equals(left._value, right._value); /// /// Compare to another Angle object /// /// /// 0 if equal - [Pure] public int CompareTo(Angle other) => Equals(Value, other.Value) ? 0 : Value.CompareTo(other.Value); + [Pure] public int CompareTo(Angle other) => Equals(_value, other._value) ? 0 : _value.CompareTo(other._value); /// /// Less than operator to compare two Angle objects @@ -179,7 +191,7 @@ public override bool Equals(object obj) /// left value /// right value /// true if left is less than right - [Pure] public static bool operator <(Angle left, Angle right) => Comparer.Default.Compare(left.Value, right.Value) < 0; + [Pure] public static bool operator <(Angle left, Angle right) => Comparer.Default.Compare(left._value, right._value) < 0; /// /// Greater than operator to compare two Angle objects @@ -187,7 +199,7 @@ public override bool Equals(object obj) /// left value /// right value /// true if left is greater than right - [Pure] public static bool operator >(Angle left, Angle right) => Comparer.Default.Compare(left.Value, right.Value) > 0; + [Pure] public static bool operator >(Angle left, Angle right) => Comparer.Default.Compare(left._value, right._value) > 0; /// /// Less than or equal operator to compare two Angle objects @@ -195,7 +207,7 @@ public override bool Equals(object obj) /// left value /// right value /// true if left is less than or equal to right - [Pure] public static bool operator <=(Angle left, Angle right) => Comparer.Default.Compare(left.Value, right.Value) <= 0; + [Pure] public static bool operator <=(Angle left, Angle right) => Comparer.Default.Compare(left._value, right._value) <= 0; /// /// Greater than or equal operator to compare two Angle objects @@ -203,7 +215,7 @@ public override bool Equals(object obj) /// left value /// right value /// true if left is greater than or equal to right - [Pure] public static bool operator >=(Angle left, Angle right) => Comparer.Default.Compare(left.Value, right.Value) >= 0; + [Pure] public static bool operator >=(Angle left, Angle right) => Comparer.Default.Compare(left._value, right._value) >= 0; // Math /// @@ -212,7 +224,7 @@ public override bool Equals(object obj) /// left value /// right value /// A new Angle object with a value of left + right - [Pure] public static Angle operator +(Angle left, Angle right) => new(left.Value + right.Value); + [Pure] public static Angle operator +(Angle left, Angle right) => new(left._value + right._value); /// /// Subtraction operator to subtract two Angle objects @@ -220,7 +232,7 @@ public override bool Equals(object obj) /// left value /// right value /// A new Angle object with a value of left - right - [Pure] public static Angle operator -(Angle left, Angle right) => new(left.Value - right.Value); + [Pure] public static Angle operator -(Angle left, Angle right) => new(left._value - right._value); /// /// Multiplication operator to multiply by a double @@ -228,7 +240,7 @@ public override bool Equals(object obj) /// object to multiply /// operand to multiply object /// A new Angle object with a value of value multiplied by the operand - [Pure] public static Angle operator *(Angle value, double operand) => new(value.Value * operand); + [Pure] public static Angle operator *(Angle value, double operand) => new(value._value * operand); /// /// Division operator to divide by a double @@ -236,19 +248,19 @@ public override bool Equals(object obj) /// object to be divided /// operand to divide object /// A new Angle object with a value of value divided by the operand - [Pure] public static Angle operator /(Angle value, double operand) => new(value.Value / operand); + [Pure] public static Angle operator /(Angle value, double operand) => new(value._value / operand); /// /// Returns the absolute value of the /// /// - [Pure] public Angle Abs() { return new Angle(Math.Abs(this.Value)); } + [Pure] public Angle Abs() { return new Angle(Math.Abs(this._value)); } /// /// Get a string representation of the object /// /// A string representing the object - [Pure] public override string ToString() => Value.ToString(); + [Pure] public override string ToString() => _value.ToString(); /// /// Get a string representation of the object @@ -256,7 +268,7 @@ public override bool Equals(object obj) /// format /// format provider /// A string representing the object - [Pure] public string ToString(string format, IFormatProvider formatProvider) => Value.ToString(format, formatProvider); + [Pure] public string ToString(string format, IFormatProvider formatProvider) => _value.ToString(format, formatProvider); // IComparable /// @@ -264,97 +276,97 @@ public override bool Equals(object obj) /// /// The other Angle cast to object /// 0 if equal - [Pure] public int CompareTo(object obj) => Value.CompareTo(obj); + [Pure] public int CompareTo(object obj) => _value.CompareTo(obj); /// /// Get type code of object /// /// The TypeCode - [Pure] public TypeCode GetTypeCode() => Value.GetTypeCode(); + [Pure] public TypeCode GetTypeCode() => _value.GetTypeCode(); /// /// Convert to boolean /// /// format provider /// bool representation of the object - [Pure] public bool ToBoolean(IFormatProvider provider) => ((IConvertible)Value).ToBoolean(provider); + [Pure] public bool ToBoolean(IFormatProvider provider) => ((IConvertible)_value).ToBoolean(provider); /// /// Convert to byte /// /// format provider /// byte representation of the object - [Pure] public byte ToByte(IFormatProvider provider) => ((IConvertible)Value).ToByte(provider); + [Pure] public byte ToByte(IFormatProvider provider) => ((IConvertible)_value).ToByte(provider); /// /// Convert to char /// /// format provider /// char representation of the object - [Pure] public char ToChar(IFormatProvider provider) => ((IConvertible)Value).ToChar(provider); + [Pure] public char ToChar(IFormatProvider provider) => ((IConvertible)_value).ToChar(provider); /// /// Convert to DateTime /// /// format provider /// DateTime representation of the object - [Pure] public DateTime ToDateTime(IFormatProvider provider) => ((IConvertible)Value).ToDateTime(provider); + [Pure] public DateTime ToDateTime(IFormatProvider provider) => ((IConvertible)_value).ToDateTime(provider); /// /// Convert to Decimal /// /// format provider /// Decimal representation of the object - [Pure] public decimal ToDecimal(IFormatProvider provider) => ((IConvertible)Value).ToDecimal(provider); + [Pure] public decimal ToDecimal(IFormatProvider provider) => ((IConvertible)_value).ToDecimal(provider); /// /// Convert to double /// /// format provider /// double representation of the object - [Pure] public double ToDouble(IFormatProvider provider) => Value; + [Pure] public double ToDouble(IFormatProvider provider) => _value; /// /// Convert to in16 /// /// format provider /// int16 representation of the object - [Pure] public short ToInt16(IFormatProvider provider) => ((IConvertible)Value).ToInt16(provider); + [Pure] public short ToInt16(IFormatProvider provider) => ((IConvertible)_value).ToInt16(provider); /// /// Convert to int32 /// /// format provider /// int32 representation of the object - [Pure] public int ToInt32(IFormatProvider provider) => ((IConvertible)Value).ToInt32(provider); + [Pure] public int ToInt32(IFormatProvider provider) => ((IConvertible)_value).ToInt32(provider); /// /// Convert to int64 /// /// format provider /// int64 representation of the object - [Pure] public long ToInt64(IFormatProvider provider) => ((IConvertible)Value).ToInt64(provider); + [Pure] public long ToInt64(IFormatProvider provider) => ((IConvertible)_value).ToInt64(provider); /// /// Convert to sbyte /// /// format provider /// sbyte representation of the object - [Pure] public sbyte ToSByte(IFormatProvider provider) => ((IConvertible)Value).ToSByte(provider); + [Pure] public sbyte ToSByte(IFormatProvider provider) => ((IConvertible)_value).ToSByte(provider); /// /// Convert to float /// /// format provider /// float representation of the object - [Pure] public float ToSingle(IFormatProvider provider) => ((IConvertible)Value).ToSingle(provider); + [Pure] public float ToSingle(IFormatProvider provider) => ((IConvertible)_value).ToSingle(provider); /// /// Convert to string /// /// format provider /// string representation of the object - [Pure] public string ToString(IFormatProvider provider) => Value.ToString(provider); + [Pure] public string ToString(IFormatProvider provider) => _value.ToString(provider); /// /// Convert to type @@ -362,28 +374,28 @@ public override bool Equals(object obj) /// conversion type /// format provider /// type representation of the object - [Pure] public object ToType(Type conversionType, IFormatProvider provider) => ((IConvertible)Value).ToType(conversionType, provider); + [Pure] public object ToType(Type conversionType, IFormatProvider provider) => ((IConvertible)_value).ToType(conversionType, provider); /// /// Convert to uint16 /// /// format provider /// uint16 representation of the object - [Pure] public ushort ToUInt16(IFormatProvider provider) => ((IConvertible)Value).ToUInt16(provider); + [Pure] public ushort ToUInt16(IFormatProvider provider) => ((IConvertible)_value).ToUInt16(provider); /// /// Convert to uint32 /// /// format provider /// uint32 representation of the object - [Pure] public uint ToUInt32(IFormatProvider provider) => ((IConvertible)Value).ToUInt32(provider); + [Pure] public uint ToUInt32(IFormatProvider provider) => ((IConvertible)_value).ToUInt32(provider); /// /// Convert to uint64 /// /// format provider /// uint64 representation of the object - [Pure] public ulong ToUInt64(IFormatProvider provider) => ((IConvertible)Value).ToUInt64(provider); + [Pure] public ulong ToUInt64(IFormatProvider provider) => ((IConvertible)_value).ToUInt64(provider); /// /// Compare the default value to a double @@ -393,7 +405,7 @@ public override bool Equals(object obj) [Pure] public int CompareTo(double? other) { - return (other is null) ? -1 : (Value).CompareTo(other.Value); + return (other is null) ? -1 : (_value).CompareTo(other.Value); } /// @@ -401,19 +413,19 @@ public int CompareTo(double? other) /// /// value to compare /// 0 if equal - [Pure] public bool Equals(double? other) => Value.Equals(other); + [Pure] public bool Equals(double? other) => _value.Equals(other); /// /// Compare the default value to a double /// /// value to compare /// 0 if equal - [Pure] public bool Equals(double other) => Value.Equals(other); + [Pure] public bool Equals(double other) => _value.Equals(other); /// /// Compare the default value to a double /// /// value to compare /// 0 if equal - [Pure] public int CompareTo(double other) => Value.CompareTo(other); + [Pure] public int CompareTo(double other) => _value.CompareTo(other); } \ No newline at end of file diff --git a/Source/Meadow.Units/Length.cs b/Source/Meadow.Units/Length.cs index 1d0cdac..980c97e 100644 --- a/Source/Meadow.Units/Length.cs +++ b/Source/Meadow.Units/Length.cs @@ -17,6 +17,18 @@ public struct Length : IComparable, IFormattable, IConvertible, IEquatable, IComparable { + private static Length _zero; + + static Length() + { + _zero = new Length(0, UnitType.Meters); + } + + /// + /// Gets a length with a value of zero + /// + public static Length Zero => _zero; + /// /// Creates a new `Length` object. /// @@ -24,7 +36,7 @@ public struct Length : /// Meters by default. public Length(double value, UnitType type = UnitType.Meters) { - Value = LengthConversions.Convert(value, type, UnitType.Meters); + _value = LengthConversions.Convert(value, type, UnitType.Meters); } /// @@ -33,13 +45,13 @@ public Length(double value, UnitType type = UnitType.Meters) /// public Length(Length length) { - this.Value = length.Value; + this._value = length._value; } /// /// Internal canonical value. /// - private readonly double Value; + private readonly double _value; /// /// The type of units available to describe the Length. @@ -153,7 +165,7 @@ public enum UnitType [Pure] public readonly double From(UnitType convertTo) { - return LengthConversions.Convert(Value, UnitType.Meters, convertTo); + return LengthConversions.Convert(_value, UnitType.Meters, convertTo); } /// @@ -173,7 +185,7 @@ public override readonly bool Equals(object obj) /// Get hash of object /// /// int32 hash value - [Pure] public override readonly int GetHashCode() => Value.GetHashCode(); + [Pure] public override readonly int GetHashCode() => _value.GetHashCode(); // implicit conversions //[Pure] public static implicit operator Length(ushort value) => new Length(value); @@ -191,7 +203,7 @@ public override readonly bool Equals(object obj) /// /// The object to compare /// true if equal - [Pure] public readonly bool Equals(Length other) => Value == other.Value; + [Pure] public readonly bool Equals(Length other) => _value == other._value; /// /// Equals operator to compare two Length objects @@ -199,7 +211,7 @@ public override readonly bool Equals(object obj) /// left value /// right value /// true if equal - [Pure] public static bool operator ==(Length left, Length right) => Equals(left.Value, right.Value); + [Pure] public static bool operator ==(Length left, Length right) => Equals(left._value, right._value); /// /// Not equals operator to compare two Length objects @@ -207,14 +219,14 @@ public override readonly bool Equals(object obj) /// left value /// right value /// true if not equal - [Pure] public static bool operator !=(Length left, Length right) => !Equals(left.Value, right.Value); + [Pure] public static bool operator !=(Length left, Length right) => !Equals(left._value, right._value); /// /// Compare to another Length object /// /// /// 0 if equal - [Pure] public readonly int CompareTo(Length other) => Equals(Value, other.Value) ? 0 : Value.CompareTo(other.Value); + [Pure] public readonly int CompareTo(Length other) => Equals(_value, other._value) ? 0 : _value.CompareTo(other._value); /// /// Less than operator to compare two Length objects @@ -222,7 +234,7 @@ public override readonly bool Equals(object obj) /// left value /// right value /// true if left is less than right - [Pure] public static bool operator <(Length left, Length right) => Comparer.Default.Compare(left.Value, right.Value) < 0; + [Pure] public static bool operator <(Length left, Length right) => Comparer.Default.Compare(left._value, right._value) < 0; /// /// Greater than operator to compare two Length objects @@ -230,7 +242,7 @@ public override readonly bool Equals(object obj) /// left value /// right value /// true if left is greater than right - [Pure] public static bool operator >(Length left, Length right) => Comparer.Default.Compare(left.Value, right.Value) > 0; + [Pure] public static bool operator >(Length left, Length right) => Comparer.Default.Compare(left._value, right._value) > 0; /// /// Less than or equal operator to compare two Length objects @@ -238,7 +250,7 @@ public override readonly bool Equals(object obj) /// left value /// right value /// true if left is less than or equal to right - [Pure] public static bool operator <=(Length left, Length right) => Comparer.Default.Compare(left.Value, right.Value) <= 0; + [Pure] public static bool operator <=(Length left, Length right) => Comparer.Default.Compare(left._value, right._value) <= 0; /// /// Greater than or equal operator to compare two Length objects @@ -246,7 +258,7 @@ public override readonly bool Equals(object obj) /// left value /// right value /// true if left is greater than or equal to right - [Pure] public static bool operator >=(Length left, Length right) => Comparer.Default.Compare(left.Value, right.Value) >= 0; + [Pure] public static bool operator >=(Length left, Length right) => Comparer.Default.Compare(left._value, right._value) >= 0; // Math /// @@ -255,7 +267,7 @@ public override readonly bool Equals(object obj) /// left value /// right value /// A new Length object with a value of left + right - [Pure] public static Length operator +(Length left, Length right) => new(left.Value + right.Value); + [Pure] public static Length operator +(Length left, Length right) => new(left._value + right._value); /// /// Subtraction operator to subtract two Length objects @@ -263,7 +275,7 @@ public override readonly bool Equals(object obj) /// left value /// right value /// A new Length object with a value of left - right - [Pure] public static Length operator -(Length left, Length right) => new(left.Value - right.Value); + [Pure] public static Length operator -(Length left, Length right) => new(left._value - right._value); /// /// Multiplication operator to multiply by a double @@ -271,7 +283,7 @@ public override readonly bool Equals(object obj) /// object to multiply /// operand to multiply object /// A new Length object with a value of value multiplied by the operand - [Pure] public static Length operator *(Length value, double operand) => new(value.Value * operand); + [Pure] public static Length operator *(Length value, double operand) => new(value._value * operand); /// /// Division operator to divide by a double @@ -279,19 +291,19 @@ public override readonly bool Equals(object obj) /// object to be divided /// operand to divide object /// A new Length object with a value of value divided by the operand - [Pure] public static Length operator /(Length value, double operand) => new(value.Value / operand); + [Pure] public static Length operator /(Length value, double operand) => new(value._value / operand); /// /// Returns the absolute value of the /// /// - [Pure] public readonly Length Abs() { return new Length(Math.Abs(this.Value)); } + [Pure] public readonly Length Abs() { return new Length(Math.Abs(this._value)); } /// /// Get a string representation of the object /// /// A string representing the object - [Pure] public override readonly string ToString() => Value.ToString(); + [Pure] public override readonly string ToString() => _value.ToString(); /// /// Get a string representation of the object @@ -299,7 +311,7 @@ public override readonly bool Equals(object obj) /// format /// format provider /// A string representing the object - [Pure] public readonly string ToString(string format, IFormatProvider formatProvider) => Value.ToString(format, formatProvider); + [Pure] public readonly string ToString(string format, IFormatProvider formatProvider) => _value.ToString(format, formatProvider); // IComparable /// @@ -307,97 +319,97 @@ public override readonly bool Equals(object obj) /// /// The other Length cast to object /// 0 if equal - [Pure] public readonly int CompareTo(object obj) => Value.CompareTo(obj); + [Pure] public readonly int CompareTo(object obj) => _value.CompareTo(obj); /// /// Get type code of object /// /// The TypeCode - [Pure] public readonly TypeCode GetTypeCode() => Value.GetTypeCode(); + [Pure] public readonly TypeCode GetTypeCode() => _value.GetTypeCode(); /// /// Convert to boolean /// /// format provider /// bool representation of the object - [Pure] public readonly bool ToBoolean(IFormatProvider provider) => ((IConvertible)Value).ToBoolean(provider); + [Pure] public readonly bool ToBoolean(IFormatProvider provider) => ((IConvertible)_value).ToBoolean(provider); /// /// Convert to byte /// /// format provider /// byte representation of the object - [Pure] public readonly byte ToByte(IFormatProvider provider) => ((IConvertible)Value).ToByte(provider); + [Pure] public readonly byte ToByte(IFormatProvider provider) => ((IConvertible)_value).ToByte(provider); /// /// Convert to char /// /// format provider /// char representation of the object - [Pure] public readonly char ToChar(IFormatProvider provider) => ((IConvertible)Value).ToChar(provider); + [Pure] public readonly char ToChar(IFormatProvider provider) => ((IConvertible)_value).ToChar(provider); /// /// Convert to DateTime /// /// format provider /// DateTime representation of the object - [Pure] public readonly DateTime ToDateTime(IFormatProvider provider) => ((IConvertible)Value).ToDateTime(provider); + [Pure] public readonly DateTime ToDateTime(IFormatProvider provider) => ((IConvertible)_value).ToDateTime(provider); /// /// Convert to Decimal /// /// format provider /// Decimal representation of the object - [Pure] public readonly decimal ToDecimal(IFormatProvider provider) => ((IConvertible)Value).ToDecimal(provider); + [Pure] public readonly decimal ToDecimal(IFormatProvider provider) => ((IConvertible)_value).ToDecimal(provider); /// /// Convert to double /// /// format provider /// double representation of the object - [Pure] public readonly double ToDouble(IFormatProvider provider) => Value; + [Pure] public readonly double ToDouble(IFormatProvider provider) => _value; /// /// Convert to in16 /// /// format provider /// int16 representation of the object - [Pure] public readonly short ToInt16(IFormatProvider provider) => ((IConvertible)Value).ToInt16(provider); + [Pure] public readonly short ToInt16(IFormatProvider provider) => ((IConvertible)_value).ToInt16(provider); /// /// Convert to int32 /// /// format provider /// int32 representation of the object - [Pure] public readonly int ToInt32(IFormatProvider provider) => ((IConvertible)Value).ToInt32(provider); + [Pure] public readonly int ToInt32(IFormatProvider provider) => ((IConvertible)_value).ToInt32(provider); /// /// Convert to int64 /// /// format provider /// int64 representation of the object - [Pure] public readonly long ToInt64(IFormatProvider provider) => ((IConvertible)Value).ToInt64(provider); + [Pure] public readonly long ToInt64(IFormatProvider provider) => ((IConvertible)_value).ToInt64(provider); /// /// Convert to sbyte /// /// format provider /// sbyte representation of the object - [Pure] public readonly sbyte ToSByte(IFormatProvider provider) => ((IConvertible)Value).ToSByte(provider); + [Pure] public readonly sbyte ToSByte(IFormatProvider provider) => ((IConvertible)_value).ToSByte(provider); /// /// Convert to float /// /// format provider /// float representation of the object - [Pure] public readonly float ToSingle(IFormatProvider provider) => ((IConvertible)Value).ToSingle(provider); + [Pure] public readonly float ToSingle(IFormatProvider provider) => ((IConvertible)_value).ToSingle(provider); /// /// Convert to string /// /// format provider /// string representation of the object - [Pure] public readonly string ToString(IFormatProvider provider) => Value.ToString(provider); + [Pure] public readonly string ToString(IFormatProvider provider) => _value.ToString(provider); /// /// Convert to type @@ -405,28 +417,28 @@ public override readonly bool Equals(object obj) /// type to covert to /// format provider /// type representation of the object - [Pure] public readonly object ToType(Type conversionType, IFormatProvider provider) => ((IConvertible)Value).ToType(conversionType, provider); + [Pure] public readonly object ToType(Type conversionType, IFormatProvider provider) => ((IConvertible)_value).ToType(conversionType, provider); /// /// Convert to uint16 /// /// format provider /// uint16 representation of the object - [Pure] public readonly ushort ToUInt16(IFormatProvider provider) => ((IConvertible)Value).ToUInt16(provider); + [Pure] public readonly ushort ToUInt16(IFormatProvider provider) => ((IConvertible)_value).ToUInt16(provider); /// /// Convert to uint32 /// /// format provider /// uint32 representation of the object - [Pure] public readonly uint ToUInt32(IFormatProvider provider) => ((IConvertible)Value).ToUInt32(provider); + [Pure] public readonly uint ToUInt32(IFormatProvider provider) => ((IConvertible)_value).ToUInt32(provider); /// /// Convert to uint64 /// /// format provider /// uint64 representation of the object - [Pure] public readonly ulong ToUInt64(IFormatProvider provider) => ((IConvertible)Value).ToUInt64(provider); + [Pure] public readonly ulong ToUInt64(IFormatProvider provider) => ((IConvertible)_value).ToUInt64(provider); /// /// Compare the default value to a double @@ -436,7 +448,7 @@ public override readonly bool Equals(object obj) [Pure] public readonly int CompareTo(double? other) { - return (other is null) ? -1 : (Value).CompareTo(other.Value); + return (other is null) ? -1 : (_value).CompareTo(other.Value); } /// @@ -444,19 +456,19 @@ public readonly int CompareTo(double? other) /// /// value to compare /// 0 if equal - [Pure] public readonly bool Equals(double? other) => Value.Equals(other); + [Pure] public readonly bool Equals(double? other) => _value.Equals(other); /// /// Compare the default value to a double /// /// value to compare /// 0 if equal - [Pure] public readonly bool Equals(double other) => Value.Equals(other); + [Pure] public readonly bool Equals(double other) => _value.Equals(other); /// /// Compare the default value to a double /// /// value to compare /// 0 if equal - [Pure] public readonly int CompareTo(double other) => Value.CompareTo(other); + [Pure] public readonly int CompareTo(double other) => _value.CompareTo(other); } \ No newline at end of file