WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

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

@angularsen

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)

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