-
Notifications
You must be signed in to change notification settings - Fork 395
Upgrading from 4.x to 5.x
Andreas Gullberg Larsen edited this page Nov 29, 2022
·
12 revisions
See v5 Release · Pull Request #982.
Most of the removed code was marked as obsolete for a long time in v4 before removed in v5 with details on what to replace the usage with.
- Localization is based on CultureInfo.CurrentCulture instead of CurrentUICulture (#795, #986)
-
IQuantity
returnsQuantityValue
instead ofdouble
(#1074) - Decimal based quantities return
decimal
instead ofdouble
(Power
,BitRate
andInformation
) (#1074)
- Remove targets: net40, net47, Windows Runtime Component. Fix: Use netstandard2.0.
- Remove
Undefined
enum value for all unit enum types. Fix: Usenull
. - Remove QuantityType enum. Fix: Use strings.
- Remove IQuantity.Units and .UnitNames. Fix: Use QuantityInfo.
- Remove IEquatable and equality operators/methods. Fix: See TODO below.
- Remove GlobalConfiguration. Fix: Change CultureInfo.CurrentCulture.
- Remove Molarity ctor and operator overloads. Fix: Use MassConcentration.FromMolarity(), ToMolarity().
- Remove MinValue, MaxValue per quantity due to ambiguity. Fix: Define your own min/max quantity values.
- Remove string format specifiers: "v", "s". Fix: Use
Value
property and standard .NET numeric format strings. - json: Remove UnitsNetJsonConverter. Fix: Use UnitsNetIQuantityJsonConverter or AbbreviatedUnitsConverter.
- QuantityValue: Implement IEquality, IComparable, IFormattable
- QuantityValue: 16 bytes instead of 40 bytes (#1084)
- Add
[DataContract]
annotations (#972)
Rename BaseType
to ValueType
, for values "double" and "decimal".
Rename XmlDoc
to XmlDocSummary
.
Add back IEquatable<T>
, but implement as strict equality with tuple of quantity name + unit + value.
https://github.com/angularsen/UnitsNet/issues/1017#issuecomment-1028401955