/// <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)); }
/// <summary> /// Returns a matching amount converted to the given unit. /// </summary> public Amount ConvertedTo(string unitName) { return(this.ConvertedTo(UnitManager.GetUnitByName(unitName))); }
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); }