示例#1
0
 public static UMoney Round(
     UMoney value,
     int scale,
     MidpointRounding mode)
 {
     return(new UMoney(Money.Round(value._value, scale, mode)));
 }
 /// <summary>
 ///    Round specified value to the specified scale and express it as a significand.
 /// </summary>
 public static UMoney Denominate(
     UMoney value,
     int scale)
 {
     return(new UMoney
            (
                significand: Money.Round(value._value, scale).Significand,
                scale: 0
            ));
 }
示例#3
0
        public static UMoney Subtract(
            UMoney left,
            UMoney right)
        {
            if (right > left)
            {
                throw new OverflowException("The result should be grater or equal to zero.");
            }

            return(new UMoney(left._value - right._value));
        }
示例#4
0
        public static bool TryParse(
            string value,
            out UMoney result)
        {
            if (value != null && UMoneyFormat.IsMatch(value))
            {
                result = Create(Money.Parse(value));

                return(true);
            }
            else
            {
                result = default;

                return(false);
            }
        }
示例#5
0
 public static UMoney Floor(
     UMoney value)
 {
     return(new UMoney(Money.Floor(value._value)));
 }
示例#6
0
 public static UMoney Divide(
     UMoney left,
     UMoney right)
 {
     return(new UMoney(left._value / right._value));
 }
示例#7
0
 public static UMoney Ceiling(
     UMoney value)
 {
     return(new UMoney(Money.Ceiling(value._value)));
 }
示例#8
0
 public static UMoney Truncate(
     UMoney value)
 {
     return(new UMoney(Money.Truncate(value._value)));
 }
示例#9
0
 public static UMoney Add(
     UMoney left,
     UMoney right)
 {
     return(Create(left._value + right._value));
 }
示例#10
0
 public static UMoney Round(
     UMoney value,
     int scale)
 {
     return(new UMoney(Money.Round(value._value, scale)));
 }
示例#11
0
 public static UMoney Multiply(
     UMoney left,
     UMoney right)
 {
     return(new UMoney(left._value * right._value));
 }