Struct MagneticField
- Namespace
- UnitsNet
- Assembly
- UnitsNet.MagneticField.dll
A magnetic field is a force field that is created by moving electric charges (electric currents) and magnetic dipoles, and exerts a force on other nearby moving charges and magnetic dipoles.
public struct MagneticField
Remarks
Constructors
MagneticField(double, MagneticFieldUnit)
Creates the quantity with the given numeric value and unit.
public MagneticField(double value, MagneticFieldUnit unit)
Parameters
value
doubleThe numeric value to construct this quantity with.
unit
MagneticFieldUnitThe unit representation to construct this quantity with.
Exceptions
- ArgumentException
If value is NaN or Infinity.
Properties
BaseUnit
The base unit of MagneticField, which is Second. All conversions go via this value.
public static MagneticFieldUnit BaseUnit { get; }
Property Value
Gausses
public double Gausses { get; }
Property Value
MaxValue
Represents the largest possible value of MagneticField.
public static MagneticField MaxValue { get; }
Property Value
Microteslas
Gets a double value of this quantity converted into Microtesla
public double Microteslas { get; }
Property Value
Milligausses
Gets a double value of this quantity converted into Milligauss
public double Milligausses { get; }
Property Value
Milliteslas
Gets a double value of this quantity converted into Millitesla
public double Milliteslas { get; }
Property Value
MinValue
Represents the smallest possible value of MagneticField.
public static MagneticField MinValue { get; }
Property Value
Nanoteslas
public double Nanoteslas { get; }
Property Value
Teslas
public double Teslas { get; }
Property Value
Unit
public MagneticFieldUnit Unit { get; }
Property Value
Value
The numeric value this quantity was constructed with.
public double Value { get; }
Property Value
Zero
Gets an instance of this quantity with a value of 0 in the base unit Second.
public static MagneticField Zero { get; }
Property Value
Methods
As(MagneticFieldUnit)
Convert to the unit representation unit
.
public double As(MagneticFieldUnit unit)
Parameters
unit
MagneticFieldUnit
Returns
- double
Value converted to the specified unit.
From(double, MagneticFieldUnit)
Dynamically convert from value and unit enum MagneticFieldUnit to MagneticField.
public static MagneticField From(double value, MagneticFieldUnit fromUnit)
Parameters
value
doubleValue to convert from.
fromUnit
MagneticFieldUnitUnit to convert from.
Returns
- MagneticField
MagneticField unit value.
FromGausses(double)
Creates a MagneticField from Gauss.
public static MagneticField FromGausses(double gausses)
Parameters
gausses
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMicroteslas(double)
Creates a MagneticField from Microtesla.
public static MagneticField FromMicroteslas(double microteslas)
Parameters
microteslas
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMilligausses(double)
Creates a MagneticField from Milligauss.
public static MagneticField FromMilligausses(double milligausses)
Parameters
milligausses
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromMilliteslas(double)
Creates a MagneticField from Millitesla.
public static MagneticField FromMilliteslas(double milliteslas)
Parameters
milliteslas
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromNanoteslas(double)
Creates a MagneticField from Nanotesla.
public static MagneticField FromNanoteslas(double nanoteslas)
Parameters
nanoteslas
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
FromTeslas(double)
Creates a MagneticField from Tesla.
public static MagneticField FromTeslas(double teslas)
Parameters
teslas
double
Returns
Exceptions
- ArgumentException
If value is NaN or Infinity.
ToUnit(MagneticFieldUnit)
Converts this MagneticField to another MagneticField with the unit representation unit
.
public MagneticField ToUnit(MagneticFieldUnit unit)
Parameters
unit
MagneticFieldUnit
Returns
- MagneticField
A MagneticField with the specified unit.