示例#1
0
 public static Money Add(Money m1, Money m2)
 {
     Money result = new Money();
     result.currency = m1.currency;
     if (m1.currency == m2.currency)
     {
         result.amount = m1.amount + m2.amount;
     }
     else
     {
         //add a conversion factor to convert from m2.currency to m1.currency.
         //A constant is used here. In real life, this will be some complicated logic.
         result.amount = m1.amount + m2.amount + 20;
     }
     return result;
 }
示例#2
0
 private Money Add(Money m1, Money m2)
 {
     return MoneyService.Add(m1, m2);
 }