XP One nuget per quantity
Related to #372, #1180
Experiment with splitting up UnitsNet nuget into:
- UnitsNet.Core (common types and abstractions)
- UnitsNet.Length
- UnitsNet.Mass
- etc..
This is already done for UnitsNet.nanoFramework nugets: https://www.nuget.org/packages?q=unitsnet.nanoframework
We might also provide meta nuget packages that bring in multiple nugets in a single package:
- UnitsNet (all nugets, like today)
- UnitsNet.Meta.SI (all SI and SI derived nugets, such as Length, Force, Mass, Area, Speed etc)
- UnitsNet.Meta.Main (the most widely used nugets, striving for 80/20 rule)
Benefits
- Smaller size, only bring the quantities you need. The
UnitsNet.dllis ~2MB as of 2023-01-07. - More extensible, it forces a design where plugging in 3rd party quantities is simpler.
Problems
-
QuantityTypeenum must be replaced by strings and usingQuantityInfoinstead -
UnitSystemandBaseUnitsrely on the 7 SI quantities Length, Mass, etc. - Arithmetic across quantities may not be feasible for the library to provide, such as
Speed = Length / DurationandMass.FromGravitationalForce(Force f). We might be able to provide this with meta nuget packages that bring in the most common quantities and arithmetic/conversions between them.
Design proposal
- Use reflection to look up all quantities in loaded assemblies at startup instead of hard coding it, to allow plugging in 3rd party quantities. Need to provide some configuration for assemblies to search or quantities to load.
- Make use of
QuantityInfoto fully describe a quantity, instead of relying on generated code for known quantities spread over various types.- Unit abbreviations for different cultures, currently loaded by
UnitAbbreviationsCache.LoadGeneratedAbbreviations()based on generated code. - Unit conversion functions, currently defined by generated code in
Acceleration.RegisterDefaultConversionsand similar for other quantities.
- Unit abbreviations for different cultures, currently loaded by
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.
test comment
test 2
test 3
test 4
test 5