Exemple #1
0
 /// <summary>
 /// Returns a matching amount converted to the given unit and rounded
 /// up to the given number of decimals.
 /// </summary>
 public Amount ConvertedTo(string unitName, int decimals)
 {
     return(this.ConvertedTo(UnitManager.GetUnitByName(unitName), decimals));
 }
Exemple #2
0
 /// <summary>
 /// Returns a matching amount converted to the given unit.
 /// </summary>
 public Amount ConvertedTo(string unitName)
 {
     return(this.ConvertedTo(UnitManager.GetUnitByName(unitName)));
 }
Exemple #3
0
 public Amount(decimal value, string unitName)
 {
     this.value = value;
     this.unit  = UnitManager.GetUnitByName(unitName);
 }
 /// <summary>
 /// Asserts a property of type IUnitConsumer has a value expressed in a unit
 /// compatible to the given one.
 /// </summary>
 public AssertUnitCompatibilityAttribute(string unitName)
     : base("Value is expressed in incompatible unit.")
 {
     unit = UnitManager.GetUnitByName(unitName);
 }