Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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 Inductance(XmlConvert.ToDouble(attribute), InductanceUnit.Henrys);
            reader.ReadStartElement();
        }
Exemplo n.º 4
0
 public static Inductance operator *(Resistance left, Time right)
 {
     return(Inductance.FromHenrys(left.ohm * right.seconds));
 }
Exemplo n.º 5
0
 public static Inductance operator *(double left, InductanceUnit right)
 {
     return(Inductance.From(left, right));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 8
0
 public bool Equals(Inductance other, Inductance tolerance)
 {
     Ensure.GreaterThan(tolerance.henrys, 0, nameof(tolerance));
     return(Math.Abs(this.henrys - other.henrys) < tolerance.henrys);
 }
Exemplo n.º 9
0
 public bool Equals(Inductance other)
 {
     return(this.henrys.Equals(other.henrys));
 }
Exemplo n.º 10
0
 public int CompareTo(Inductance quantity)
 {
     return(this.henrys.CompareTo(quantity.henrys));
 }
Exemplo n.º 11
0
 public static bool TryParse(string text, NumberStyles styles, IFormatProvider provider, out Inductance result)
 {
     return(QuantityParser.TryParse <InductanceUnit, Inductance>(text, From, styles, provider, out result));
 }
Exemplo n.º 12
0
 public static bool TryParse(string text, NumberStyles styles, out Inductance result)
 {
     return(QuantityParser.TryParse <InductanceUnit, Inductance>(text, From, styles, CultureInfo.CurrentCulture, out result));
 }
Exemplo n.º 13
0
 public static Inductance operator /(MagneticFlux left, Current right)
 {
     return(Inductance.FromHenrys(left.webers / right.amperes));
 }