示例#1
0
        /// <summary>
        /// Reads an instance of <see cref="Gu.Units.Wavenumber"/> from the <paramref name="reader"/>
        /// </summary>
        /// <param name="reader"></param>
        /// <returns>An instance of  <see cref="Gu.Units.Wavenumber"/></returns>
        public static Wavenumber ReadFrom(XmlReader reader)
        {
            var v = new Wavenumber();

            v.ReadXml(reader);
            return(v);
        }
示例#2
0
        /// <devdoc>
        /// <para>Converts the given object to a <see cref='Gu.Units.Wavenumber'/>
        /// object.</para>
        /// </devdoc>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var text = value as string;

            if (text != null)
            {
                return(Wavenumber.Parse(text, culture));
            }

            return(base.ConvertFrom(context, culture, value));
        }
示例#3
0
        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();
            var attribute = reader.GetAttribute("Value");

            if (attribute is null)
            {
                throw new XmlException($"Could not find attribute named: Value");
            }

            this = new Wavenumber(XmlConvert.ToDouble(attribute), WavenumberUnit.ReciprocalMetres);
            reader.ReadStartElement();
        }
示例#4
0
 /// <summary>
 /// Multiplies <paramref name="left"/> with <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the multiplication.</returns>
 public static Wavenumber operator *(Flexibility left, Pressure right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metresPerNewton * right.pascals));
 }
 public static Wavenumber operator /(Frequency left, Speed right)
 {
     return(Wavenumber.FromReciprocalMetres(left.hertz / right.metresPerSecond));
 }
示例#6
0
 public static Wavenumber operator /(Area left, Volume right)
 {
     return(Wavenumber.FromReciprocalMetres(left.squareMetres / right.cubicMetres));
 }
示例#7
0
 public static Wavenumber operator /(Force left, Energy right)
 {
     return(Wavenumber.FromReciprocalMetres(left.newtons / right.joules));
 }
示例#8
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Pressure left, Stiffness right)
 {
     return(Wavenumber.FromReciprocalMetres(left.pascals / right.newtonsPerMetre));
 }
示例#9
0
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Wavenumber"/> object within the given tolerance.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Wavenumber as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Wavenumber"/> 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(Wavenumber other, Wavenumber tolerance)
 {
     Ensure.GreaterThan(tolerance.reciprocalMetres, 0, nameof(tolerance));
     return(Math.Abs(this.reciprocalMetres - other.reciprocalMetres) < tolerance.reciprocalMetres);
 }
示例#10
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The Wavenumber that is the result from the division.</returns>
 public static Wavenumber operator /(double left, Length right)
 {
     return(Wavenumber.FromReciprocalMetres(left / right.metres));
 }
示例#11
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Density left, AreaDensity right)
 {
     return(Wavenumber.FromReciprocalMetres(left.kilogramsPerCubicMetre / right.kilogramsPerSquareMetre));
 }
示例#12
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Length left, Area right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metres / right.squareMetres));
 }
示例#13
0
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Wavenumber"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Wavenumber"/></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="Wavenumber"/></param>
 /// <returns>True if an instance of <see cref="Wavenumber"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Wavenumber result)
 {
     return(QuantityParser.TryParse <WavenumberUnit, Wavenumber>(text, From, styles, provider, out result));
 }
示例#14
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Speed left, KinematicViscosity right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metresPerSecond / right.squareMetresPerSecond));
 }
示例#15
0
 /// <summary>
 /// Creates an instance of <see cref="Gu.Units.Wavenumber"/> from its string representation
 /// </summary>
 /// <param name="text">The string representation of the <see cref="Gu.Units.Wavenumber"/></param>
 /// <param name="styles">Specifies the <see cref="NumberStyles"/> to be used.</param>
 /// <param name="result">The parsed <see cref="Wavenumber"/></param>
 /// <returns>True if an instance of <see cref="Wavenumber"/> could be parsed from <paramref name="text"/></returns>
 public static bool TryParse(string text, NumberStyles styles, out Wavenumber result)
 {
     return(QuantityParser.TryParse <WavenumberUnit, Wavenumber>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
示例#16
0
 public static Wavenumber operator /(Acceleration left, SpecificEnergy right)
 {
     return(Wavenumber.FromReciprocalMetres(left.metresPerSecondSquared / right.joulesPerKilogram));
 }
示例#17
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Stiffness left, Force right)
 {
     return(Wavenumber.FromReciprocalMetres(left.newtonsPerMetre / right.newtons));
 }
 public static Wavenumber operator *(Resistance left, Conductivity right)
 {
     return(Wavenumber.FromReciprocalMetres(left.ohms * right.siemensPerMetre));
 }
示例#19
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(Conductivity left, ElectricalConductance right)
 {
     return(Wavenumber.FromReciprocalMetres(left.siemensPerMetre / right.siemens));
 }
示例#20
0
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(MassFlow left, Momentum right)
 {
     return(Wavenumber.FromReciprocalMetres(left.kilogramsPerSecond / right.newtonSecond));
 }
示例#21
0
 /// <summary>
 /// Compares this instance to a specified <see cref="Gu.Units.Wavenumber"/> 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.Wavenumber"/> 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.Wavenumber"/> object to compare to this instance.</param>
 public int CompareTo(Wavenumber quantity)
 {
     return(this.reciprocalMetres.CompareTo(quantity.reciprocalMetres));
 }
 /// <summary>
 /// Divides <paramref name="left"/> by <paramref name="right"/>
 /// </summary>
 /// <param name="left">The left value</param>
 /// <param name="right">The right value</param>
 /// <returns>The <see cref="Wavenumber"/> that is the result from the division.</returns>
 public static Wavenumber operator /(KinematicViscosity left, VolumetricFlow right)
 {
     return(Wavenumber.FromReciprocalMetres(left.squareMetresPerSecond / right.cubicMetresPerSecond));
 }
示例#23
0
 /// <summary>
 /// Returns a quantity indicating whether this instance is equal to a specified <see cref="Gu.Units.Wavenumber"/> object.
 /// </summary>
 /// <returns>
 /// true if <paramref name="other"/> represents the same Wavenumber as this instance; otherwise, false.
 /// </returns>
 /// <param name="other">An instance of <see cref="Gu.Units.Wavenumber"/> object to compare with this instance.</param>
 public bool Equals(Wavenumber other)
 {
     return(this.reciprocalMetres.Equals(other.reciprocalMetres));
 }