You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This avoids the boxing of the struct via the IQuantity<TUnit> interface which is currently used by the static Format.
Now, obviously once this is done- the two existing overloads should be deprecated, however the question arises- whether there should by a static alternative or can we simply point to the QuantityFormatter.Default? Note that should we decide to have the static TQuantity versions, then we won't be able to have both use the same name..
We should probably also take / expose an instance of the QuantityFormatter on the UnitsNetSetup, but that's not a requirement.
The text was updated successfully, but these errors were encountered:
Regarding static methods, I don't think QuantityFormatter.Format() is something many do, it feels more of an internal component to me, so I vote for instance methods only and require users to go via UnitsNetSetup.Default.QuantityFormatter.
Just like the
UnitParser
and theQuantityParser
can be created with anUnitAbbreviationsCache
- the same goes for theQuantityFormatter
.This should allow for different parts of the application to use their own "defaults".
In terms of implementation - we can keep the static
Format
methods, but they should delegate the call to theDefault
instance.There is a slight problem with the name collision- but my plan involves changing the instance member generic parameter to
This avoids the boxing of the struct via the
IQuantity<TUnit>
interface which is currently used by the staticFormat
.Now, obviously once this is done- the two existing overloads should be deprecated, however the question arises- whether there should by a static alternative or can we simply point to the
QuantityFormatter.Default
? Note that should we decide to have the staticTQuantity
versions, then we won't be able to have both use the same name..We should probably also take / expose an instance of the
QuantityFormatter
on theUnitsNetSetup
, but that's not a requirement.The text was updated successfully, but these errors were encountered: