示例#1
0
 /// <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);
 }
示例#2
0
        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));
        }
示例#3
0
 /// <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)));
 }