Struct LengthValue
- Namespace
- xFunc.Maths.Expressions.Units.LengthUnits
- Assembly
- xFunc.Maths.dll
Represents a number with unit.
public readonly struct LengthValue : IEquatable<LengthValue>, IComparable<LengthValue>, IComparable- Implements
- Inherited Members
Constructors
LengthValue(NumberValue, LengthUnit)
Initializes a new instance of the LengthValue struct.
public LengthValue(NumberValue value, LengthUnit unit)Parameters
- valueNumberValue
- The value. 
- unitLengthUnit
- The unit of number. 
Properties
Sign
Gets an integer that indicates the sign of a double-precision floating-point number.
public double Sign { get; }Property Value
Unit
Gets a unit.
public LengthUnit Unit { get; }Property Value
Value
Gets a value.
public NumberValue Value { get; }Property Value
Methods
Abs(LengthValue)
Returns the absolute value of a specified value.
public static LengthValue Abs(LengthValue value)Parameters
- valueLengthValue
- The value. 
Returns
- LengthValue
- The power value, - x, that such that 0 ≤- x≤- MaxValue.
AsExpression()
Converts LengthValue to Length.
public Length AsExpression()Returns
- Length
- The length number. 
AstronomicalUnit(double)
Creates the LengthValue struct with Astronomical  Unit unit.
public static LengthValue AstronomicalUnit(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
AstronomicalUnit(NumberValue)
Creates the LengthValue struct with Astronomical Unit unit.
public static LengthValue AstronomicalUnit(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Ceiling(LengthValue)
Returns the smallest integral value that is greater than or equal to the specified value.
public static LengthValue Ceiling(LengthValue value)Parameters
- valueLengthValue
- The value. 
Returns
- LengthValue
- The smallest integral value. 
Centimeter(double)
Creates the LengthValue struct with Centimeter unit.
public static LengthValue Centimeter(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Centimeter(NumberValue)
Creates the LengthValue struct with Centimeter unit.
public static LengthValue Centimeter(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Chain(double)
Creates the LengthValue struct with Chain unit.
public static LengthValue Chain(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Chain(NumberValue)
Creates the LengthValue struct with Chain unit.
public static LengthValue Chain(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)Parameters
- objobject
- An object to compare with this instance. 
Returns
- int
- A value that indicates the relative order of the objects being compared. The return value has these meanings: - Value - Meaning - Less than zero - This instance precedes - objin the sort order.- Zero - This instance occurs in the same position in the sort order as - obj.- Greater than zero - This instance follows - objin the sort order.
Exceptions
- ArgumentException
- objis not the same type as this instance.
CompareTo(LengthValue)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(LengthValue other)Parameters
- otherLengthValue
- An object to compare with this instance. 
Returns
- int
- A value that indicates the relative order of the objects being compared. The return value has these meanings: - Value - Meaning - Less than zero - This instance precedes - otherin the sort order.- Zero - This instance occurs in the same position in the sort order as - other.- Greater than zero - This instance follows - otherin the sort order.
Decimeter(double)
Creates the LengthValue struct with Decimeter unit.
public static LengthValue Decimeter(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Decimeter(NumberValue)
Creates the LengthValue struct with Decimeter unit.
public static LengthValue Decimeter(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
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(LengthValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(LengthValue other)Parameters
- otherLengthValue
- An object to compare with this object. 
Returns
Floor(LengthValue)
Returns the largest integral value less than or equal to the specified value number.
public static LengthValue Floor(LengthValue value)Parameters
- valueLengthValue
- The value. 
Returns
- LengthValue
- The largest integral value. 
Foot(double)
Creates the LengthValue struct with Foot unit.
public static LengthValue Foot(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Foot(NumberValue)
Creates the LengthValue struct with Foot unit.
public static LengthValue Foot(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Frac(LengthValue)
Returns the fractional part of the value number.
public static LengthValue Frac(LengthValue value)Parameters
- valueLengthValue
- The value number. 
Returns
- LengthValue
- The fractional part. 
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. 
Inch(double)
Creates the LengthValue struct with Inch unit.
public static LengthValue Inch(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Inch(NumberValue)
Creates the LengthValue struct with Inch unit.
public static LengthValue Inch(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Kilometer(double)
Creates the LengthValue struct with Kilometer unit.
public static LengthValue Kilometer(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Kilometer(NumberValue)
Creates the LengthValue struct with Kilometer unit.
public static LengthValue Kilometer(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
LightYear(double)
Creates the LengthValue struct with LightYear unit.
public static LengthValue LightYear(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
LightYear(NumberValue)
Creates the LengthValue struct with LightYear unit.
public static LengthValue LightYear(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Meter(double)
Creates the LengthValue struct with Meter unit.
public static LengthValue Meter(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Meter(NumberValue)
Creates the LengthValue struct with Meter unit.
public static LengthValue Meter(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Micrometer(double)
Creates the LengthValue struct with Micrometer unit.
public static LengthValue Micrometer(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Micrometer(NumberValue)
Creates the LengthValue struct with Micrometer unit.
public static LengthValue Micrometer(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Mile(double)
Creates the LengthValue struct with Mile unit.
public static LengthValue Mile(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Mile(NumberValue)
Creates the LengthValue struct with Mile unit.
public static LengthValue Mile(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Millimeter(double)
Creates the LengthValue struct with Millimeter unit.
public static LengthValue Millimeter(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Millimeter(NumberValue)
Creates the LengthValue struct with Millimeter unit.
public static LengthValue Millimeter(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Nanometer(double)
Creates the LengthValue struct with Nanometer unit.
public static LengthValue Nanometer(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Nanometer(NumberValue)
Creates the LengthValue struct with Nanometer unit.
public static LengthValue Nanometer(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
NauticalMile(double)
Creates the LengthValue struct with Nautical Mile unit.
public static LengthValue NauticalMile(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
NauticalMile(NumberValue)
Creates the LengthValue struct with Nautical Mile unit.
public static LengthValue NauticalMile(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Parsec(double)
Creates the LengthValue struct with Parsec unit.
public static LengthValue Parsec(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Parsec(NumberValue)
Creates the LengthValue struct with Parsec unit.
public static LengthValue Parsec(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Rod(double)
Creates the LengthValue struct with Rod unit.
public static LengthValue Rod(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Rod(NumberValue)
Creates the LengthValue struct with Rod unit.
public static LengthValue Rod(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Round(LengthValue, NumberValue)
Rounds a double-precision floating-point value to a specified number of fractional digits, and uses the specified rounding convention for midpoint values.
public static LengthValue Round(LengthValue lengthValue, NumberValue digits)Parameters
- lengthValueLengthValue
- The number. 
- digitsNumberValue
- The number of fractional digits in the return value. 
Returns
- LengthValue
- The number nearest to - lengthValuethat has a number of fractional digits equal to- digits. If value has fewer fractional digits than- digits,- lengthValueis returned unchanged.
To(LengthUnit)
Convert to the newUnit unit.
public LengthValue To(LengthUnit newUnit)Parameters
- newUnitLengthUnit
- The new unit. 
Returns
- LengthValue
- The value in the new unit. 
ToAstronomicalUnit()
Converts the value to the astronomical unit.
public LengthValue ToAstronomicalUnit()Returns
- LengthValue
- The value in astronomical unit. 
ToCentimeter()
Converts the value to the centimeter unit.
public LengthValue ToCentimeter()Returns
- LengthValue
- The value in centimeter unit. 
ToChain()
Converts the value to the chain unit.
public LengthValue ToChain()Returns
- LengthValue
- The value in chain unit. 
ToDecimeter()
Converts the value to the decimeter unit.
public LengthValue ToDecimeter()Returns
- LengthValue
- The value in decimeter unit. 
ToFoot()
Converts the value to the foot unit.
public LengthValue ToFoot()Returns
- LengthValue
- The value in foot unit. 
ToInch()
Converts the value to the inch unit.
public LengthValue ToInch()Returns
- LengthValue
- The value in inch unit. 
ToKilometer()
Converts the value to the kilometer unit.
public LengthValue ToKilometer()Returns
- LengthValue
- The value in kilometer unit. 
ToLightYear()
Converts the value to the light year unit.
public LengthValue ToLightYear()Returns
- LengthValue
- The value in light year unit. 
ToMeter()
Converts the value to the meter unit.
public LengthValue ToMeter()Returns
- LengthValue
- The value in meter unit. 
ToMicrometer()
Converts the value to the micrometer unit.
public LengthValue ToMicrometer()Returns
- LengthValue
- The value in micrometer unit. 
ToMile()
Converts the value to the mile unit.
public LengthValue ToMile()Returns
- LengthValue
- The value in mile unit. 
ToMillimeter()
Converts the value to the millimeter unit.
public LengthValue ToMillimeter()Returns
- LengthValue
- The value in millimeter unit. 
ToNanometer()
Converts the value to the nanometer unit.
public LengthValue ToNanometer()Returns
- LengthValue
- The value in nanometer unit. 
ToNauticalMile()
Converts the value to the nautical mile unit.
public LengthValue ToNauticalMile()Returns
- LengthValue
- The value in nautical mile unit. 
ToParsec()
Converts the value to the parsec unit.
public LengthValue ToParsec()Returns
- LengthValue
- The value in parsec unit. 
ToRod()
Converts the value to the rod unit.
public LengthValue ToRod()Returns
- LengthValue
- The value in rod unit. 
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()Returns
- string
- The fully qualified type name. 
ToYard()
Converts the value to the yard unit.
public LengthValue ToYard()Returns
- LengthValue
- The value in yard unit. 
Truncate(LengthValue)
Calculates the integral part of a specified value number.
public static LengthValue Truncate(LengthValue value)Parameters
- valueLengthValue
- An value to truncate. 
Returns
- LengthValue
- The integral part of value number. 
Yard(double)
Creates the LengthValue struct with Yard unit.
public static LengthValue Yard(double value)Parameters
- valuedouble
- The value. 
Returns
- LengthValue
- The length value. 
Yard(NumberValue)
Creates the LengthValue struct with Yard unit.
public static LengthValue Yard(NumberValue value)Parameters
- valueNumberValue
- The value. 
Returns
- LengthValue
- The length value. 
Operators
operator +(LengthValue, LengthValue)
Adds two objects of LengthValue.
public static LengthValue operator +(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The first object to add. 
- rightLengthValue
- The second object to add. 
Returns
- LengthValue
- An object that is the sum of - leftand- right.
operator ==(LengthValue, LengthValue)
Determines whether two specified instances of LengthValue are equal.
public static bool operator ==(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The first object to compare. 
- rightLengthValue
- The second object to compare. 
Returns
- bool
- trueif- leftis equal to- right; otherwise,- false.
operator >(LengthValue, LengthValue)
Indicates whether left parameter is greater than the right parameter.
public static bool operator >(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The left value. 
- rightLengthValue
- The right value. 
Returns
- bool
- trueif the- leftparameter is greater than the- rightparameter; otherwise,- false.
operator >=(LengthValue, LengthValue)
Indicates whether left parameter is greater than or equal to the right parameter.
public static bool operator >=(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The left value. 
- rightLengthValue
- The right value. 
Returns
- bool
- trueif the- leftparameter is greater than or equal to the- rightparameter; otherwise,- false.
operator !=(LengthValue, LengthValue)
Determines whether two specified instances of LengthValue are equal.
public static bool operator !=(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The first object to compare. 
- rightLengthValue
- The second object to compare. 
Returns
- bool
- trueif- leftis equal to- right; otherwise,- false.
operator <(LengthValue, LengthValue)
Indicates whether left parameter is less than the right parameter.
public static bool operator <(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The left value. 
- rightLengthValue
- The right value. 
Returns
- bool
- trueif the- leftparameter is less than the- rightparameter; otherwise,- false.
operator <=(LengthValue, LengthValue)
Indicates whether left parameter is less than or equal to the right parameter.
public static bool operator <=(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The left value. 
- rightLengthValue
- The right value. 
Returns
- bool
- trueif the- leftparameter is less than or equal to the- rightparameter; otherwise,- false.
operator *(AreaValue, LengthValue)
Multiplies two objects of LengthValue.
public static VolumeValue operator *(AreaValue left, LengthValue right)Parameters
- leftAreaValue
- The first object to multiply. 
- rightLengthValue
- The second object to multiply. 
Returns
- VolumeValue
- An object that is the product of - leftand- right.
operator *(LengthValue, AreaValue)
Multiplies two objects of LengthValue.
public static VolumeValue operator *(LengthValue left, AreaValue right)Parameters
- leftLengthValue
- The first object to multiply. 
- rightAreaValue
- The second object to multiply. 
Returns
- VolumeValue
- An object that is the product of - leftand- right.
operator *(LengthValue, LengthValue)
Multiplies two objects of LengthValue.
public static AreaValue operator *(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The first object to multiply. 
- rightLengthValue
- The second object to multiply. 
Returns
- AreaValue
- An object that is the product of - leftand- right.
operator -(LengthValue, LengthValue)
Subtracts two objects of LengthValue.
public static LengthValue operator -(LengthValue left, LengthValue right)Parameters
- leftLengthValue
- The first object to sub. 
- rightLengthValue
- The second object to sub. 
Returns
- LengthValue
- An object that is the difference of - leftand- right.
operator -(LengthValue)
Produces the negative of LengthValue.
public static LengthValue operator -(LengthValue value)Parameters
- valueLengthValue
- The value. 
Returns
- LengthValue
- The negative of - value.