-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Was IQuantity.Value's return type intended to change to QuantityValue at v5? #1205
Comments
It was introduced here, to better support decimal quantities. Previously, double was always returned, also for decimal quantities. Implicit cast from This may all be moot if we indeed remove decimal altogether, as discussed in #1194 (comment) |
Fair enough. Code incoming :) |
I present #1207 |
Ref #1205 - Add `IValueQuantity<TValue>` extending `IQuantity` to expose double/decimal types instead of `QuantityValue` - Add `IQuantity<TUnitType, out TValueType>`, extending `IValueQuantity<TValue>` with value specific `As(TUnitType)` method - Mark `IDecimalQuantity` obsolete, replaced by above --------- Co-authored-by: Andreas Gullberg Larsen <andreas.larsen84@gmail.com>
At v5
IQuantity.Value
now returns aQuantityValue
type rather than double. Was this intended? It's a bit of an obscure change sinceIQuantity.Value
is implemented explicitly, so only seen when you have a left-hand side type ofIQuantity
.We have hundreds of places where we pass
IQuantity.Value
to an internal double method, and upgrading to v5 would require a cast to double on each one.Changing it back to double does not break any tests FWIW.
The text was updated successfully, but these errors were encountered: