Example #1
0
 /// <summary>
 /// 转换到指定单位
 /// </summary>
 /// <param name="toUnit"></param>
 /// <returns></returns>
 public CNY ConvertTo(CnyUnit toUnit)
 {
     if (this.Unit == toUnit)
     {
         return(this);
     }
     if (this.Unit == CnyUnit.分)
     {
         return(new CNY {
             Unit = toUnit, Amount = this.Amount / 100m
         });
     }
     return(new CNY {
         Unit = toUnit, Amount = this.Amount * 100m
     });
 }
Example #2
0
 /// <summary>
 /// 人民币
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="unit"></param>
 public CNY(decimal amount, CnyUnit unit)
 {
     this.Unit   = unit;
     this.Amount = amount;
 }