`QuantityInfo`: internalizing the `UnitInfo` construction
QuantityInfo: internalizing theUnitInfoconstructionQuantityInfo: introducing a delegate for constructing the quantity (required only for net standard)QuantityInfo: introducing an optionalResourceDictionaryQuantityInfo: replacing theTUnit[]with anIReadOnlyCollection<TUnit>UnitInfo: introducing a back-reference to theQuantityInfo(making theQuantityName[Obsolete])IQuantity: added theQuantityInfo<TQuantity, TUnit>, theFrom(double, TUnit)method and default implementations for the non-generic propertiesQuantityInfoLookup: added another collection for the quantity by type mapping (replacing the generated code inQuantity.g.s).UnitAbbreviationsCache:ReadAbbreviationsFromResourceFileimplemented using the providedResourceManager(if available)- updating the
QuantityInfodefinitions for all quantities (introducing a concrete class, such asMassInfo) with helpers for creating a derived configuration HowMuchupgraded toIQuantity<HowMuch, HowMuchUnit>(the originalQuantityInfois now abstract)Quantityrefactored theParse/From*methods using the defaultQuantityParser/QuantityInfoLookupQuantityreplaced theByNamedictionary with anIReadOnlyDictionaryUnitsNet.csproj/UnitsNet.Tests.csproj: added some (specific) implicit usings
@angularsen The most breaking thing here should be the change from MassUnit[] to IReadOnlyCollection<MassUnit>: we still have the IReadOnlyList<UnitInfo>, so if anybody want to do a for-loop that's still an option, but in my opinion, having the indexer (backed by a dictionary) is more interesting than having 2 read-only lists, but if you want I could switch it.
Providing a delegate and resource dictionary in the QuantityInfo does look like we're mixing the domain with the infrastructure, but since we want to support nestandard2.0 this was the simplest way to have an all in one definition, that can support both internal and external quantities.
PS The UnitInfo is still missing the conversion expressions, that should be used by the UnitConverter, and we still don't have a way to configure/customize the UnitsNetSetup.Default, but for the rest of the classes (UnitParser, UnitAbbreviationsCache etc)- we're pretty close to my final version.
PS2 The new size is:
2.53 MB (2 661 376 bytes)
which is up from
2.18 MB (2 287 616 bytes)
but that would go down again, when I remove all the RegisterDefaultConversions and the switch expressions:
1.78 MB (1 867 776 bytes)
@lipchev just a heads up that this week is crazy for me and I'm traveling this weekend, not sure I'll get around to much
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This PR was automatically closed due to inactivity.