-
Notifications
You must be signed in to change notification settings - Fork 402
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.
Removed code is typically marked as obsolete in the previous version with details on what to replace the usage with.
The biggest change is removing support for decimal quantities, affecting Power, Information, BitRate now converted from decimal to double and the double+decimal value holder type QuantityValue is replaced by double.
The motivation for this is to reduce a ton of complexity in the code base. Decimal was initially added for precision issues since 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 float, decimal or even Half, then a more holistic approach is required using generics, which brings its own challenges.
- Remove
decimalsupport in quantities #1359 - Convert quantities
Power,Information,BitRatefromdecimaltodouble#1195, #1353 - Remove
QuantityValue, replaced withdouble - 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
- 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
- Allow
NaN,Infvalues for quantities withdoublevalue type #1289
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.