Skip to content

Map and look up unit abbreviations by strings instead of enums #1067

Description

@angularsen

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:
#1062 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpinnedIssues that should not be auto-closed due to inactivity.

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions