Description
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.
- To be sure: am I expected to return
QuantityType.Undefined
likeHowMuch
? - Can we make QuantityType extensible in some way?