public static double ConvertToUnit(this NumericValue numericValue, UnitOfMeasure targetUom) { if (targetUom == null) { throw new ArgumentNullException("targetUom"); } var unitOfMeasure = numericValue.UnitOfMeasure; var internalUnit = InternalUnitSystemManager.Instance.UnitOfMeasures[unitOfMeasure.Code]; numericValue.Value = new UnitOfMeasureConverter().Convert(internalUnit, targetUom, numericValue.Value); numericValue.UnitOfMeasure = targetUom.ToModelUom(); return(numericValue.Value); }
public static double ConvertToUnit(this NumericValue numericValue, UnitOfMeasure targetUom) { if (targetUom == null) throw new ArgumentNullException("targetUom"); var unitOfMeasure = numericValue.UnitOfMeasure; var internalUnit = InternalUnitSystemManager.Instance.UnitOfMeasures[unitOfMeasure.Code]; numericValue.Value = new UnitOfMeasureConverter().Convert(internalUnit, targetUom, numericValue.Value); numericValue.UnitOfMeasure = targetUom.ToModelUom(); return numericValue.Value; }