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

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

            if (text != null)
            {
                return(Inductance.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 Inductance(XmlConvert.ToDouble(attribute), InductanceUnit.Henrys);
            reader.ReadStartElement();
        }
Beispiel #4
0
 public static Inductance operator *(Resistance left, Time right)
 {
     return(Inductance.FromHenrys(left.ohm * right.seconds));
 }
Beispiel #5
0
 public static Inductance operator *(double left, InductanceUnit right)
 {
     return(Inductance.From(left, right));
 }
Beispiel #6
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="Inductance"/> that is the result from the division.</returns>
 public static Inductance operator /(Resistance left, Frequency right)
 {
     return(Inductance.FromHenrys(left.ohms / right.hertz));
 }
Beispiel #7
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="Inductance"/> that is the result from the division.</returns>
 public static Inductance operator /(Time left, ElectricalConductance right)
 {
     return(Inductance.FromHenrys(left.seconds / right.siemens));
 }
 public bool Equals(Inductance other, Inductance tolerance)
 {
     Ensure.GreaterThan(tolerance.henrys, 0, nameof(tolerance));
     return(Math.Abs(this.henrys - other.henrys) < tolerance.henrys);
 }
 public bool Equals(Inductance other)
 {
     return(this.henrys.Equals(other.henrys));
 }
 public int CompareTo(Inductance quantity)
 {
     return(this.henrys.CompareTo(quantity.henrys));
 }
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Inductance result)
 {
     return(QuantityParser.TryParse <InductanceUnit, Inductance>(text, From, styles, provider, out result));
 }
 public static bool TryParse(string text, NumberStyles styles, out Inductance result)
 {
     return(QuantityParser.TryParse <InductanceUnit, Inductance>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
Beispiel #13
0
 public static Inductance operator /(MagneticFlux left, Current right)
 {
     return(Inductance.FromHenrys(left.webers / right.amperes));
 }