v6 Release
This issue serves as a place to discuss what to include in this version, since major version bumps allow us to make breaking changes we think are necessary or worth it.
The wishlist keeps track of the items to include, but items may be added or removed at any time.
As changes are completed, they are added to https://github.com/angularsen/UnitsNet/wiki/Upgrading-from-5.x-to-6.x
Changes
- [x] Remove BtuPerSquareFootDegreeFahrenheit #1372
- [ ] Fix plural form of
Speed.MeterPerMinute - [ ] Rename/fix calorie/btu units to specify their definition as International Steam Table (IT) or Thermochemical (th), see https://github.com/angularsen/UnitsNet/pull/1196/files#r1105112205
- [ ] Consistent imperial/UK/US unit namings https://github.com/angularsen/UnitsNet/issues/1200#issuecomment-1493079083
- [x]
UnitAbbreviationsCache.ctor()should create empty cache, not load default abbreviations https://github.com/angularsen/UnitsNet/pull/1476 - [x]
UnitParser.ctor(UnitAbbreviationsCache)should not fallback to built-in units if givennullhttps://github.com/angularsen/UnitsNet/pull/1477 - [ ] Rename
AbsorbedDoseOfIonizingRadiationtoRadiationAbsorbedDosehttps://github.com/angularsen/UnitsNet/pull/1352#issuecomment-1879666525 - [ ] Review all
[Obsolete]in code and add to this list- [ ] Remove obsolete
Equalsoverloads https://github.com/angularsen/UnitsNet/pull/1396#issuecomment-2171563287 - [ ] ~~Remove static
Defaultgetters pointing toUnitsNetSetup.Default~~ https://github.com/angularsen/UnitsNet/pull/1475 reverted by #1480
- [ ] Remove obsolete
- [ ] Fix typo in
TonneSquareMilimeter, missingl - [x] Fix typo in
VolumeConcentration.LitersPerMililiter, missinglhttps://github.com/angularsen/UnitsNet/pull/1497 - [x] Remove
TorquePerLength: dimensionless, domain specific, conflicts withForce = Torque / Lengthhttps://github.com/angularsen/UnitsNet/pull/1458 - [x] Rename
ThermalResistancetoThermalInsulance: enables future conversions between thermal conductivity, resistivity if added https://github.com/angularsen/UnitsNet/pull/1460 - [ ] Change
Anglebase unit fromDegreetoRadian - [ ] Fix typo
KiloNewton=>KilonewtoninSpecificFuelConsumption.json - [x] https://github.com/angularsen/UnitsNet/issues/1445
- [x] #1467
- [x] #1482
- [x] #1531
- [ ] Remove
IConvertiblefromIQuantity#1550 - [ ] Update wiki regarding
IQuantityand sample quantity https://github.com/angularsen/UnitsNet/issues/1519#issuecomment-2698816808 - [ ] Consolidate
UnitsNetSetup.Default.UnitConverterand each quantity'sDefaultConversionFunctions, these can become inconsistent when adding custom conversion functions at runtime. Consider makingDefaultConversionFunctionsinternal, not public. - [ ] Moved
IQuantitymethods to extension methods withUntypedsuffix, e.g.ToUnit()becomesToUnitUntyped()to improve intellisense from strongly typed extension methods #1600
Fixed
- [x] #1465
Add System.Text.Json support https://github.com/angularsen/UnitsNet/pull/966
Decide on a naming and abbreviation convention for imperial/UK units and US units; like gallon, ounces, cup etc.
It is a bit of a mess right now:


LINQPad sample
void ListUnits(string withPartialName)
{
Quantity.Infos
.SelectMany(i => i.UnitInfos
.Where(n => n.Name.Contains(withPartialName))
.Select(u => new
{
u.Name,
Abbrev = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(u.Value.GetType(), Convert.ToInt32(u.Value))
}))
.Dump(withPartialName);
}
ListUnits("Uk");
ListUnits("Imperial");
ListUnits("Us");
I personally like "UK", since it is shorter and better matches "US". Wolfram also uses US gallon and UK gallon.
Some conventions for imperial gallons: https://en.wikipedia.org/wiki/Gallon#:~:text=the%20imperial%20gallon%20(imp%20gal,American%20and%20Caribbean%20countries%3B%20and
Today the abbreviation convention is gal (U.S.) and gal (imp.).
Depending on landing on UK or imperial naming, we could go with one of these pairs:
-
US galandUK gal -
US galandimp gal -
gal (US)andgal (UK)
We can support multiple of these plus the old ones, but the primary form should be standardized across the different units.
Do not throw ArgumentException on NaN, Inf+ or Inf- or give a way to configure the behavior globally.
Context: https://github.com/angularsen/UnitsNet/issues/1268#issuecomment-1630856242
I think UnitsNet should be more extensible. Perhaps there could be a base package, but separate NuGet packages for US measurements, Imperial, UK, etc. Alternatively, customizable abbreviations could be a solution. I would never expect me or my users to see "gal (US)" instead of "gal". This would also help the debate here.
UPDATE:
Custom abbreviations already exist: UnitAbbreviationsCache.Default.MapUnitToDefaultAbbreviation(HowMuchUnit.Some, "sm");
I think UnitsNet should be more extensible.
Conceptually, I agree.
Customizable abbreviations is already supported as you found, and we support custom quantities and units with some limited functionality: https://github.com/angularsen/UnitsNet/wiki/Extending-with-Custom-Units
Splitting up in packages is not so easy though. Things like Torque = Force * Length becomes problematic when types exist in different packages and they can't have circular dependencies. Imperial is even worse, splitting some units of a quantity to different packages. The main problem is static typing, which is also one of the main features of UnitsNet.
One benefit of splitting up in packages is smaller binary size to only bring in what you need. Some prototyping here: #1181
I was requested to give a list of units with the wrong plural form (see #1330 )
I checked the .json-file with the speed units and only MetersPerMinute has a wrong plural form, all other Speed units seem to have the correct plural form.
@Markussp256
I was requested to give a list of units with the wrong plural form (see #1330 )
I checked the .json-file with the speed units and only MetersPerMinute has a wrong plural form, all other Speed units seem to have the correct plural form.
Some more fixes were made recently in #1351