/// <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); }
/// <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)); }
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(); }
public bool Equals(MagneticFieldStrength other, MagneticFieldStrength tolerance) { Ensure.GreaterThan(tolerance.teslas, 0, nameof(tolerance)); return(Math.Abs(this.teslas - other.teslas) < tolerance.teslas); }
public bool Equals(MagneticFieldStrength other) { return(this.teslas.Equals(other.teslas)); }
public int CompareTo(MagneticFieldStrength quantity) { return(this.teslas.CompareTo(quantity.teslas)); }
public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out MagneticFieldStrength result) { return(QuantityParser.TryParse <MagneticFieldStrengthUnit, MagneticFieldStrength>(text, From, styles, provider, out result)); }
public static bool TryParse(string text, NumberStyles styles, out MagneticFieldStrength result) { return(QuantityParser.TryParse <MagneticFieldStrengthUnit, MagneticFieldStrength>(text, From, styles, CultureInfo.CurrentCulture, out result)); }
/// <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)); }
/// <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)); }
public static MagneticFieldStrength operator /(MagneticFlux left, Area right) { return(MagneticFieldStrength.FromTeslas(left.webers / right.squareMetres)); }
/// <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)); }