Skip to content

QuantityType is not extensible #858

Closed
@generateui

Description

@generateui

I'm currently adding some quantities with units for a specific domain. I miss a few things which I ideally like to see, most of these are convenience features which I can happily work around.

I have added .json files with specification into my own project. In there, I have defined quantities. I then wrote a script to copy these json files to the Common/UnitDefinitions folder of UnitsNet project. I subsequently ran the CodeGen assembly.

Changes made to the UnitsNet project make mostly sense.

One thing which does not make sense to me is the use of QuantityType as enum. I can't just add a QuantityType member - enums are not extensible. Note that the guide refers to HowMuch quantity which returns undefined.

An alternative would be to make QuantityType an interface IQuantityType with static instances.

  1. To be sure: am I expected to return QuantityType.Undefined like HowMuch?
  2. Can we make QuantityType extensible in some way?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions