Пример #1
0
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.MolarMass"/> object.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same MolarMass as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.MolarMass"/> object to compare with this instance.</param>
 public bool Equals(MolarMass other)
 {
     return(this.kilogramsPerMole.Equals(other.kilogramsPerMole));
 }
Пример #2
0
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.MolarMass"/> object within the given tolerance.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same MolarMass as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.MolarMass"/> object to compare with this instance.</param>
 /// <param name="tolerance">The maximum difference for being considered equal. Must be greater than zero.</param>
 public bool Equals(MolarMass other, MolarMass tolerance)
 {
     Ensure.GreaterThan(tolerance.kilogramsPerMole, 0, nameof(tolerance));
     return(Math.Abs(this.kilogramsPerMole - other.kilogramsPerMole) < tolerance.kilogramsPerMole);
 }
Пример #3
0
 /// <summary>
 /// Compares this instance to a specified <see cref="Gu.Units.MolarMass"/> object and returns an integer that indicates whether this <paramref name="quantity"/> is smaller than, equal to, or greater than the <see cref="Gu.Units.MolarMass"/> object.
 /// </summary>
 /// <returns>
 /// A signed number indicating the relative quantitys of this instance and <paramref name="quantity"/>.
 /// Value
 /// Description
 /// A negative integer
 /// This instance is smaller than <paramref name="quantity"/>.
 /// Zero
 /// This instance is equal to <paramref name="quantity"/>.
 /// A positive integer
 /// This instance is larger than <paramref name="quantity"/>.
 /// </returns>
 /// <param name="quantity">An instance of <see cref="Gu.Units.MolarMass"/> object to compare to this instance.</param>
 public int CompareTo(MolarMass quantity)
 {
     return(this.kilogramsPerMole.CompareTo(quantity.kilogramsPerMole));
 }
Пример #4
0
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.MolarMass"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.MolarMass"/></param>
 /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param>
 /// <param name="provider">Specifies the formatProvider to be used.</param>
 /// <param name="result">The parsed <see cref="MolarMass"/></param>
 /// <returns>True if an instance of <see cref="MolarMass"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out MolarMass result)
 {
     return(QuantityParser.TryParse <MolarMassUnit, MolarMass>(text, From, styles, provider, out result));
 }
Пример #5
0
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.MolarMass"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.MolarMass"/></param>
 /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param>
 /// <param name="result">The parsed <see cref="MolarMass"/></param>
 /// <returns>True if an instance of <see cref="MolarMass"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, out MolarMass result)
 {
     return(QuantityParser.TryParse <MolarMassUnit, MolarMass>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
Пример #6
0
 public static MolarMass operator /(MassFlow left, CatalyticActivity right)
 {
     return(MolarMass.FromKilogramsPerMole(left.kilogramsPerSecond / right.katals));
 }
Пример #7
0
 public static MolarMass operator /(Mass left, AmountOfSubstance right)
 {
     return(MolarMass.FromKilogramsPerMole(left.kilograms / right.moles));
 }