You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Changes
- Remove `QuantityValue`, replaced with `double`
- Remove `TValueType` from interfaces
- Remove `IQuantity<TUnitType, out TValueType>`
- Remove `IValueQuantity<out TValueType>`
- Change `IQuantity<TSelf, TUnitType, out TValueType>` to
`IQuantity<TSelf, TUnitType>`
- Change `IArithmeticQuantity<TSelf, TUnitType, TValueType>` to
`IArithmeticQuantity<TSelf, TUnitType>`
### Changes to UnitsNet.Serialiation.JsonNet
- Deserializing previously serialized JSON for decimal quantities
`Information`, `BitRate` and `Power` still work, but it now reads just
`double Value` property and ignores `string ValueString` and `string
ValueType` properties. This may lose precision compared to preserving
the full `decimal` value, but `decimal` is no longer supported in v6.
### Background
In #1195@angularsen says:
> If we change all 3 quantities to double, we have the potential to
clean up a LOT of QuantityValue complexity.
This made me wonder how deep that complexity goes so I decided to
experiment, and this is the result.
I must say some of these changes make me a bit sad. A lot of work and
some very clever thinking went into supporting multiple numerical types,
and I want to acknowledge that. 🙇
Also, I took it as far as possible but that might not be the best
outcome, for example we might want to keep deserialization support. This
just demonstrates a possible direction we could go in.
---------
Co-authored-by: Andreas Gullberg Larsen <[email protected]>
public static {_quantity.Name} From{unit.PluralName}({_quantity.ValueType}{valueParamName}) => new {_quantity.Name}({valueParamName}, {_unitEnumName}.{unit.SingularName});
149
+
public static {_quantity.Name} From{unit.PluralName}(double{valueParamName}) => new {_quantity.Name}({valueParamName}, {_unitEnumName}.{unit.SingularName});
0 commit comments