UnitsNet
UnitsNet copied to clipboard
Map and look up unit abbreviations by strings instead of enums
Blocks #1181
QuantityType
enum is already deprecated and will be removed in #982 in order to better support third-party quantities and units.
The same could be done for the 100+ unit enums, like LengthUnit
Instead of
string abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unitInfo.GetType(), (int)unitInfo);
We could support, without breaking change:
string abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation("Length", "Millimeter");
Optionally, we could deprecate the enum-based overloads and remove them in #982 or future major version bump.
Related to discussion: https://github.com/angularsen/UnitsNet/issues/1062#issuecomment-1073219229
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.