private UOM GetUOM(UOMCode code) { EnsureCacheIsLoaded(); if (_uomCache.TryGetValue(code.Code, out UOM result)) { return(result); } return(null); }
public double ConvertBetween(UOMCode source, UOMCode destination, double value) { UOM uomSource = GetUOM(source); UOM uomDestination = GetUOM(destination); double newValue = value; if (uomSource != null && uomDestination != null && uomSource != uomDestination) { newValue = ConvertFromBase(ConvertToBase(value, uomSource), uomDestination); } return(newValue); }