コード例 #1
0
        //This is a full Value object now
        public static Money Create(string currency, decimal amount, DateTime?time)
        {
            DateTime t = time != null ? time.Value : DateTimeRangeExtensions.GetDate();

            return(new Money(currency, amount, t));
        }
コード例 #2
0
 public static Money GetDifference(this Money money, Money _money)
 {
     if (money.Currency != _money.Currency)
     {
         throw new Exception("Different currencies");
     }
     return(Money.Create(money.Currency, Math.Abs(money.Amount - _money.Amount), DateTimeRangeExtensions.GetDate()));
 }