/// <summary> /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.LengthUnit"/> object. /// </summary> /// <param name="other">An instance of <see cref="Gu.Units.LengthUnit"/> object to compare with this instance.</param> /// <returns> /// true if <paramref name="other"/> represents the same LengthUnit as this instance; otherwise, false. /// </returns> public bool Equals(LengthUnit other) { return(this.symbol == other.symbol); }
/// <summary> /// Creates an instance of <see cref="Gu.Units.LengthUnit"/> from its string representation /// </summary> /// <param name="text">The string representation of the <see cref="Gu.Units.LengthUnit"/></param> /// <param name="result">The parsed <see cref="LengthUnit"/></param> /// <returns>True if an instance of <see cref="LengthUnit"/> could be parsed from <paramref name="text"/></returns> public static bool TryParse(string text, out LengthUnit result) { return(UnitParser <LengthUnit> .TryParse(text, out result)); }
/// <summary> /// Initializes a new instance of <see cref="T:Gu.Units.Length"/>. /// </summary> /// <param name="value"></param> /// <param name="unit"><see cref="T:Gu.Units.Metres"/>.</param> public Length(double value, LengthUnit unit) { this.metres = unit.ToSiUnit(value); }
public string ToString(string format, IFormatProvider formatProvider, LengthUnit unit) { var quantity = unit.FromSiUnit(this.metres); return(string.Format("{0}{1}", quantity.ToString(format, formatProvider), unit.Symbol)); }
/// <summary> /// Creates a new instance of <see cref="T:Gu.Units.Length"/>. /// </summary> /// <param name="value"></param> /// <param name="unit"></param> public static Length From(double value, LengthUnit unit) { return(new Length(unit.ToSiUnit(value))); }