Struct LengthUnit
- Namespace
- xFunc.Maths.Expressions.Units.LengthUnits
- Assembly
- xFunc.Maths.dll
Represents a length unit.
public readonly struct LengthUnit : IEquatable<LengthUnit>- Implements
- Inherited Members
Fields
AstronomicalUnit
The astronomical unit (au) unit.
public static readonly LengthUnit AstronomicalUnitField Value
Centimeter
The centimeter (cm) unit.
public static readonly LengthUnit CentimeterField Value
Chain
The chain (ch) unit.
public static readonly LengthUnit ChainField Value
Decimeter
The decimeter (dm) unit.
public static readonly LengthUnit DecimeterField Value
Foot
The foot (ft) unit.
public static readonly LengthUnit FootField Value
Inch
The inch (in) unit.
public static readonly LengthUnit InchField Value
Kilometer
The kilometer (km) unit.
public static readonly LengthUnit KilometerField Value
LightYear
The light year (ly) unit.
public static readonly LengthUnit LightYearField Value
Meter
The meter (m) unit.
public static readonly LengthUnit MeterField Value
Micrometer
The micrometer (µm) unit.
public static readonly LengthUnit MicrometerField Value
Mile
The mile (mi) unit.
public static readonly LengthUnit MileField Value
Millimeter
The millimeter (mm) unit.
public static readonly LengthUnit MillimeterField Value
Nanometer
The nanometer (nm) unit.
public static readonly LengthUnit NanometerField Value
NauticalMile
The nautical mile (nmi) unit.
public static readonly LengthUnit NauticalMileField Value
Parsec
The parsec (pc) unit.
public static readonly LengthUnit ParsecField Value
Rod
The rod (rd) unit.
public static readonly LengthUnit RodField Value
Yard
The yard (yd) unit.
public static readonly LengthUnit YardField Value
Properties
Factor
Gets a factor of conversion from this unit to base unit.
public double Factor { get; }Property Value
Names
Gets all available unit names.
public static IEnumerable<string> Names { get; }Property Value
UnitName
Gets a short name of the unit.
public string UnitName { get; }Property Value
Units
Gets all available units.
[ExcludeFromCodeCoverage]
public static IEnumerable<LengthUnit> Units { get; }Property Value
Methods
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)Parameters
- objobject
- The object to compare with the current instance. 
Returns
- bool
- true if - objand this instance are the same type and represent the same value; otherwise, false.
Equals(LengthUnit)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(LengthUnit other)Parameters
- otherLengthUnit
- An object to compare with this object. 
Returns
FromName(string, out LengthUnit)
Gets a unit by name.
public static bool FromName(string name, out LengthUnit unit)Parameters
- namestring
- The name of unit. 
- unitLengthUnit
- When this method returns, the value associated with the specified name, if the unit is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. 
Returns
- bool
- trueif length units contain an unit with the specified- name; otherwise,- false.
Exceptions
- ArgumentNullException
- nameis- null.
GetHashCode()
Returns the hash code for this instance.
[ExcludeFromCodeCoverage]
public override int GetHashCode()Returns
- int
- A 32-bit signed integer that is the hash code for this instance. 
ToAreaUnit()
Maps the current length unit to area unit.
public AreaUnit ToAreaUnit()Returns
- AreaUnit
- The area unit. 
Exceptions
- InvalidOperationException
- Cannot convert the current LengthUnit to an AreaUnit. 
- See Also
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()Returns
- string
- The fully qualified type name. 
Operators
operator ==(LengthUnit, LengthUnit)
Determines whether two specified instances of LengthValue are equal.
public static bool operator ==(LengthUnit left, LengthUnit right)Parameters
- leftLengthUnit
- The first object to compare. 
- rightLengthUnit
- The second object to compare. 
Returns
- bool
- trueif- leftis equal to- right; otherwise,- false.
operator !=(LengthUnit, LengthUnit)
Determines whether two specified instances of LengthValue are equal.
public static bool operator !=(LengthUnit left, LengthUnit right)Parameters
- leftLengthUnit
- The first object to compare. 
- rightLengthUnit
- The second object to compare. 
Returns
- bool
- trueif- leftis equal to- right; otherwise,- false.