Пример #1
0
 /// <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);
 }
Пример #2
0
        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));
        }
Пример #3
0
 /// <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)));
 }