-
Notifications
You must be signed in to change notification settings - Fork 403
Upgrading from 5.x to 6.x
v6 is still being developed, so this page is not yet complete. See https://github.com/angularsen/UnitsNet/issues/1200 for details.
Before upgrading to a new major version, first upgrade to the latest minor version and follow instructions on any build warnings by code marked as obsolete. This can make it easier to migrate.
The biggest change is removing support for decimal quantities and converting Power, Information, BitRate from decimal to double.
The value holder type QuantityValue is replaced by double.
The motivation was to remove a lot of complexity in the code base. Decimal was initially added for precision issues, but this was later fixed by storing both value and unit. Only Information still had any real benefit from decimal, to better represent Bit as an integer type and avoid rounding errors.
If there is still enough demand for representing bits as an integer or avoiding rounding errors in Information and other quantities, then we can approach that in a simpler way like TimeSpan.Ticks vs TimeSpan.TotalSeconds.
If there is sufficient demand for supporting any number type like float, decimal or even Half, then a more holistic approach is required using generics, which brings its own challenges.
- Allow
NaN,Infvalues for quantities withdoublevalue type #1289
- Remove
decimalsupport in quantities #1359, everything is nowdouble- Convert quantities
Power,Information,BitRatefromdecimaltodouble#1195, #1353 - Remove
QuantityValue, replaced withdouble
- Convert quantities
- Remove
TValueTypefrom interfaces- Remove
IQuantity<TUnitType, out TValueType> - Remove
IValueQuantity<out TValueType> - Change
IQuantity<TSelf, TUnitType, out TValueType>toIQuantity<TSelf, TUnitType> - Change
IArithmeticQuantity<TSelf, TUnitType, TValueType>toIArithmeticQuantity<TSelf, TUnitType>
- Remove
- Remove obsolete units #1372
-
CoefficientOfThermalExpansion.InverseKelvin,InverseDegreeCelsius,InverseDegreeFahrenheit HeatTransferCoefficient.BtuPerSquareFootDegreeFahrenheit
-
- Fix typo in plural form of several units #1347, #1351
TemperatureGradient.DegreesCelsiusPerMeterDensity.GramsPerDeciliter-
ElectricPotentialChangeRate.VoltsPerSecond,VoltsPerMicrosecond,VoltsPerMinute,VoltsPerHour FuelEfficiency.KilometersPerLiterSpeed.MetersPerMinute
- Moved 29 operator overloads for multiply or division to another type (details), e.g.
Energy op_Multiply(Duration, Power)moved fromPowertoDuration#1329
None.
None.
https://learn.microsoft.com/en-us/dotnet/core/compatibility/8.0
Binary incompatible - When run against the new runtime or component, existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
Source incompatible - When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
Behavioral change - Existing code and binaries may behave differently at run time. If the new behavior is undesirable, existing code would need to be updated and recompiled.
- Removed
"ValueType": "decimal"used fordecimalquantities