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