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

            v.ReadXml(reader);
            return(v);
        }
예제 #2
0
        /// <inheritdoc />
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var text = value as string;

            if (text != null)
            {
                return(MagneticFieldStrength.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 MagneticFieldStrength(XmlConvert.ToDouble(attribute), MagneticFieldStrengthUnit.Teslas);
            reader.ReadStartElement();
        }
예제 #4
0
 public bool Equals(MagneticFieldStrength other, MagneticFieldStrength tolerance)
 {
     Ensure.GreaterThan(tolerance.teslas, 0, nameof(tolerance));
     return(Math.Abs(this.teslas - other.teslas) < tolerance.teslas);
 }
예제 #5
0
 public bool Equals(MagneticFieldStrength other)
 {
     return(this.teslas.Equals(other.teslas));
 }
예제 #6
0
 public int CompareTo(MagneticFieldStrength quantity)
 {
     return(this.teslas.CompareTo(quantity.teslas));
 }
예제 #7
0
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out MagneticFieldStrength result)
 {
     return(QuantityParser.TryParse <MagneticFieldStrengthUnit, MagneticFieldStrength>(text, From, styles, provider, out result));
 }
예제 #8
0
 public static bool TryParse(string text, NumberStyles styles, out MagneticFieldStrength result)
 {
     return(QuantityParser.TryParse <MagneticFieldStrengthUnit, MagneticFieldStrength>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
예제 #9
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="MagneticFieldStrength"/> that is the result from the division.</returns>
 public static MagneticFieldStrength operator /(MassFlow left, ElectricCharge right)
 {
     return(MagneticFieldStrength.FromTeslas(left.kilogramsPerSecond / right.coulombs));
 }
예제 #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 <see cref="MagneticFieldStrength"/> that is the result from the division.</returns>
 public static MagneticFieldStrength operator /(Stiffness left, Current right)
 {
     return(MagneticFieldStrength.FromTeslas(left.newtonsPerMetre / right.amperes));
 }
예제 #11
0
 public static MagneticFieldStrength operator /(MagneticFlux left, Area right)
 {
     return(MagneticFieldStrength.FromTeslas(left.webers / right.squareMetres));
 }
예제 #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="MagneticFieldStrength"/> that is the result from the division.</returns>
 public static MagneticFieldStrength operator /(Voltage left, KinematicViscosity right)
 {
     return(MagneticFieldStrength.FromTeslas(left.volts / right.squareMetresPerSecond));
 }