Table of Contents

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 AstronomicalUnit

Field Value

LengthUnit

Centimeter

The centimeter (cm) unit.

public static readonly LengthUnit Centimeter

Field Value

LengthUnit

Chain

The chain (ch) unit.

public static readonly LengthUnit Chain

Field Value

LengthUnit

Decimeter

The decimeter (dm) unit.

public static readonly LengthUnit Decimeter

Field Value

LengthUnit

Foot

The foot (ft) unit.

public static readonly LengthUnit Foot

Field Value

LengthUnit

Inch

The inch (in) unit.

public static readonly LengthUnit Inch

Field Value

LengthUnit

Kilometer

The kilometer (km) unit.

public static readonly LengthUnit Kilometer

Field Value

LengthUnit

LightYear

The light year (ly) unit.

public static readonly LengthUnit LightYear

Field Value

LengthUnit

Meter

The meter (m) unit.

public static readonly LengthUnit Meter

Field Value

LengthUnit

Micrometer

The micrometer (µm) unit.

public static readonly LengthUnit Micrometer

Field Value

LengthUnit

Mile

The mile (mi) unit.

public static readonly LengthUnit Mile

Field Value

LengthUnit

Millimeter

The millimeter (mm) unit.

public static readonly LengthUnit Millimeter

Field Value

LengthUnit

Nanometer

The nanometer (nm) unit.

public static readonly LengthUnit Nanometer

Field Value

LengthUnit

NauticalMile

The nautical mile (nmi) unit.

public static readonly LengthUnit NauticalMile

Field Value

LengthUnit

Parsec

The parsec (pc) unit.

public static readonly LengthUnit Parsec

Field Value

LengthUnit

Rod

The rod (rd) unit.

public static readonly LengthUnit Rod

Field Value

LengthUnit

Yard

The yard (yd) unit.

public static readonly LengthUnit Yard

Field Value

LengthUnit

Properties

Factor

Gets a factor of conversion from this unit to base unit.

public double Factor { get; }

Property Value

double

Names

Gets all available unit names.

public static IEnumerable<string> Names { get; }

Property Value

IEnumerable<string>

UnitName

Gets a short name of the unit.

public string UnitName { get; }

Property Value

string

Units

Gets all available units.

public static IEnumerable<LengthUnit> Units { get; }

Property Value

IEnumerable<LengthUnit>

Methods

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

other LengthUnit

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

FromName(string, out LengthUnit)

Gets a unit by name.

public static bool FromName(string name, out LengthUnit unit)

Parameters

name string

The name of unit.

unit LengthUnit

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

true if length units contain an unit with the specified name; otherwise, false.

Exceptions

ArgumentNullException

name is null.

GetHashCode()

Returns the hash code for this instance.

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

left LengthUnit

The first object to compare.

right LengthUnit

The second object to compare.

Returns

bool

true if left is 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

left LengthUnit

The first object to compare.

right LengthUnit

The second object to compare.

Returns

bool

true if left is equal to right; otherwise, false.