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
value
NumberValueThe value.
unit
LengthUnitThe 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
value
LengthValueThe 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
value
doubleThe value.
Returns
- LengthValue
The length value.
AstronomicalUnit(NumberValue)
Creates the LengthValue struct with Astronomical Unit
unit.
public static LengthValue AstronomicalUnit(NumberValue value)
Parameters
value
NumberValueThe 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
value
LengthValueThe value.
Returns
- LengthValue
The smallest integral value.
Centimeter(double)
Creates the LengthValue struct with Centimeter
unit.
public static LengthValue Centimeter(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Centimeter(NumberValue)
Creates the LengthValue struct with Centimeter
unit.
public static LengthValue Centimeter(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Chain(double)
Creates the LengthValue struct with Chain
unit.
public static LengthValue Chain(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Chain(NumberValue)
Creates the LengthValue struct with Chain
unit.
public static LengthValue Chain(NumberValue value)
Parameters
value
NumberValueThe 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
obj
objectAn 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 obj
in the sort order.Zero This instance occurs in the same position in the sort order as obj
.Greater than zero This instance follows obj
in the sort order.
Exceptions
- ArgumentException
obj
is 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
other
LengthValueAn 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 other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
Decimeter(double)
Creates the LengthValue struct with Decimeter
unit.
public static LengthValue Decimeter(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Decimeter(NumberValue)
Creates the LengthValue struct with Decimeter
unit.
public static LengthValue Decimeter(NumberValue value)
Parameters
value
NumberValueThe 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
obj
objectThe 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(LengthValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(LengthValue other)
Parameters
other
LengthValueAn 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
value
LengthValueThe value.
Returns
- LengthValue
The largest integral value.
Foot(double)
Creates the LengthValue struct with Foot
unit.
public static LengthValue Foot(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Foot(NumberValue)
Creates the LengthValue struct with Foot
unit.
public static LengthValue Foot(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Frac(LengthValue)
Returns the fractional part of the value number.
public static LengthValue Frac(LengthValue value)
Parameters
value
LengthValueThe value number.
Returns
- LengthValue
The fractional part.
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.
Inch(double)
Creates the LengthValue struct with Inch
unit.
public static LengthValue Inch(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Inch(NumberValue)
Creates the LengthValue struct with Inch
unit.
public static LengthValue Inch(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Kilometer(double)
Creates the LengthValue struct with Kilometer
unit.
public static LengthValue Kilometer(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Kilometer(NumberValue)
Creates the LengthValue struct with Kilometer
unit.
public static LengthValue Kilometer(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
LightYear(double)
Creates the LengthValue struct with LightYear
unit.
public static LengthValue LightYear(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
LightYear(NumberValue)
Creates the LengthValue struct with LightYear
unit.
public static LengthValue LightYear(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Meter(double)
Creates the LengthValue struct with Meter
unit.
public static LengthValue Meter(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Meter(NumberValue)
Creates the LengthValue struct with Meter
unit.
public static LengthValue Meter(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Micrometer(double)
Creates the LengthValue struct with Micrometer
unit.
public static LengthValue Micrometer(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Micrometer(NumberValue)
Creates the LengthValue struct with Micrometer
unit.
public static LengthValue Micrometer(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Mile(double)
Creates the LengthValue struct with Mile
unit.
public static LengthValue Mile(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Mile(NumberValue)
Creates the LengthValue struct with Mile
unit.
public static LengthValue Mile(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Millimeter(double)
Creates the LengthValue struct with Millimeter
unit.
public static LengthValue Millimeter(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Millimeter(NumberValue)
Creates the LengthValue struct with Millimeter
unit.
public static LengthValue Millimeter(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Nanometer(double)
Creates the LengthValue struct with Nanometer
unit.
public static LengthValue Nanometer(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Nanometer(NumberValue)
Creates the LengthValue struct with Nanometer
unit.
public static LengthValue Nanometer(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
NauticalMile(double)
Creates the LengthValue struct with Nautical Mile
unit.
public static LengthValue NauticalMile(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
NauticalMile(NumberValue)
Creates the LengthValue struct with Nautical Mile
unit.
public static LengthValue NauticalMile(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Parsec(double)
Creates the LengthValue struct with Parsec
unit.
public static LengthValue Parsec(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Parsec(NumberValue)
Creates the LengthValue struct with Parsec
unit.
public static LengthValue Parsec(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Rod(double)
Creates the LengthValue struct with Rod
unit.
public static LengthValue Rod(double value)
Parameters
value
doubleThe value.
Returns
- LengthValue
The length value.
Rod(NumberValue)
Creates the LengthValue struct with Rod
unit.
public static LengthValue Rod(NumberValue value)
Parameters
value
NumberValueThe 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
lengthValue
LengthValueThe number.
digits
NumberValueThe number of fractional digits in the return value.
Returns
- LengthValue
The number nearest to
lengthValue
that has a number of fractional digits equal todigits
. If value has fewer fractional digits thandigits
,lengthValue
is returned unchanged.
To(LengthUnit)
Convert to the newUnit
unit.
public LengthValue To(LengthUnit newUnit)
Parameters
newUnit
LengthUnitThe 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
value
LengthValueAn 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
value
doubleThe value.
Returns
- LengthValue
The length value.
Yard(NumberValue)
Creates the LengthValue struct with Yard
unit.
public static LengthValue Yard(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- LengthValue
The length value.
Operators
operator +(LengthValue, LengthValue)
Adds two objects of LengthValue.
public static LengthValue operator +(LengthValue left, LengthValue right)
Parameters
left
LengthValueThe first object to add.
right
LengthValueThe second object to add.
Returns
- LengthValue
An object that is the sum of
left
andright
.
operator ==(LengthValue, LengthValue)
Determines whether two specified instances of LengthValue are equal.
public static bool operator ==(LengthValue left, LengthValue right)
Parameters
left
LengthValueThe first object to compare.
right
LengthValueThe second object to compare.
Returns
- bool
true
ifleft
is equal toright
; otherwise,false
.
operator >(LengthValue, LengthValue)
Indicates whether left
parameter is greater than the right
parameter.
public static bool operator >(LengthValue left, LengthValue right)
Parameters
left
LengthValueThe left value.
right
LengthValueThe right value.
Returns
- bool
true
if theleft
parameter is greater than theright
parameter; 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
left
LengthValueThe left value.
right
LengthValueThe right value.
Returns
- bool
true
if theleft
parameter is greater than or equal to theright
parameter; otherwise,false
.
operator !=(LengthValue, LengthValue)
Determines whether two specified instances of LengthValue are equal.
public static bool operator !=(LengthValue left, LengthValue right)
Parameters
left
LengthValueThe first object to compare.
right
LengthValueThe second object to compare.
Returns
- bool
true
ifleft
is equal toright
; otherwise,false
.
operator <(LengthValue, LengthValue)
Indicates whether left
parameter is less than the right
parameter.
public static bool operator <(LengthValue left, LengthValue right)
Parameters
left
LengthValueThe left value.
right
LengthValueThe right value.
Returns
- bool
true
if theleft
parameter is less than theright
parameter; 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
left
LengthValueThe left value.
right
LengthValueThe right value.
Returns
- bool
true
if theleft
parameter is less than or equal to theright
parameter; otherwise,false
.
operator *(AreaValue, LengthValue)
Multiplies two objects of LengthValue.
public static VolumeValue operator *(AreaValue left, LengthValue right)
Parameters
left
AreaValueThe first object to multiply.
right
LengthValueThe second object to multiply.
Returns
- VolumeValue
An object that is the product of
left
andright
.
operator *(LengthValue, AreaValue)
Multiplies two objects of LengthValue.
public static VolumeValue operator *(LengthValue left, AreaValue right)
Parameters
left
LengthValueThe first object to multiply.
right
AreaValueThe second object to multiply.
Returns
- VolumeValue
An object that is the product of
left
andright
.
operator *(LengthValue, LengthValue)
Multiplies two objects of LengthValue.
public static AreaValue operator *(LengthValue left, LengthValue right)
Parameters
left
LengthValueThe first object to multiply.
right
LengthValueThe second object to multiply.
Returns
- AreaValue
An object that is the product of
left
andright
.
operator -(LengthValue, LengthValue)
Subtracts two objects of LengthValue.
public static LengthValue operator -(LengthValue left, LengthValue right)
Parameters
left
LengthValueThe first object to sub.
right
LengthValueThe second object to sub.
Returns
- LengthValue
An object that is the difference of
left
andright
.
operator -(LengthValue)
Produces the negative of LengthValue.
public static LengthValue operator -(LengthValue value)
Parameters
value
LengthValueThe value.
Returns
- LengthValue
The negative of
value
.