コード例 #1
0
        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);
        }
コード例 #2
0
      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;
      }