/// <summary> /// Initializes a new instance of <see cref="T:Gu.Units.Energy"/>. /// </summary> /// <param name="value"></param> /// <param name="unit"><see cref="T:Gu.Units.Joules"/>.</param> public Energy(double value, EnergyUnit unit) { this.joules = unit.ToSiUnit(value); }
public string ToString(string format, IFormatProvider formatProvider, EnergyUnit unit) { var quantity = unit.FromSiUnit(this.joules); return(string.Format("{0}{1}", quantity.ToString(format, formatProvider), unit.Symbol)); }
/// <summary> /// Creates a new instance of <see cref="T:Gu.Units.Energy"/>. /// </summary> /// <param name="value"></param> /// <param name="unit"></param> public static Energy From(double value, EnergyUnit unit) { return(new Energy(unit.ToSiUnit(value))); }