private static QuantityFormat <TUnit> CreateFromValueAndSymbolFormats(ValueAndSymbolFormatKey key) { var valueFormat = DoubleFormatCache.GetOrCreate(key.ValueFormat); var symbolFormat = UnitFormatCache <TUnit> .GetOrCreate(key.SymbolFormat, out TUnit unit); return(QuantityFormat <TUnit> .Create(valueFormat, symbolFormat, unit)); }
internal static QuantityFormat <TUnit> GetOrCreate(string valueFormat, string symbolFormat) { var key = new ValueAndSymbolFormatKey(valueFormat, symbolFormat); return(Cache.GetOrAdd(key, _ => CreateFromValueAndSymbolFormats(key))); }