Struct VolumeValue
- Namespace
- xFunc.Maths.Expressions.Units.VolumeUnits
- Assembly
- xFunc.Maths.dll
Represents a number with unit.
public readonly struct VolumeValue : IEquatable<VolumeValue>, IComparable<VolumeValue>, IComparable
- Implements
- Inherited Members
Constructors
VolumeValue(NumberValue, VolumeUnit)
Initializes a new instance of the VolumeValue struct.
public VolumeValue(NumberValue value, VolumeUnit unit)
Parameters
value
NumberValueThe value.
unit
VolumeUnitThe 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 VolumeUnit Unit { get; }
Property Value
Value
Gets a value.
public NumberValue Value { get; }
Property Value
Methods
Abs(VolumeValue)
Returns the absolute value of a specified value.
public static VolumeValue Abs(VolumeValue value)
Parameters
value
VolumeValueThe value.
Returns
- VolumeValue
The power value,
x
, that such that 0 ≤x
≤MaxValue
.
AsExpression()
Converts VolumeValue to Volume.
public Volume AsExpression()
Returns
- Volume
The volume number.
Ceiling(VolumeValue)
Returns the smallest integral value that is greater than or equal to the specified value.
public static VolumeValue Ceiling(VolumeValue value)
Parameters
value
VolumeValueThe value.
Returns
- VolumeValue
The smallest integral value.
Centimeter(double)
Creates the VolumeValue struct with Centimeter
unit.
public static VolumeValue Centimeter(double value)
Parameters
value
doubleThe value.
Returns
- VolumeValue
The volume value.
Centimeter(NumberValue)
Creates the VolumeValue struct with Centimeter
unit.
public static VolumeValue Centimeter(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- VolumeValue
The volume 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(VolumeValue)
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(VolumeValue other)
Parameters
other
VolumeValueAn 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.
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(VolumeValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(VolumeValue other)
Parameters
other
VolumeValueAn object to compare with this object.
Returns
Floor(VolumeValue)
Returns the largest integral value less than or equal to the specified value number.
public static VolumeValue Floor(VolumeValue value)
Parameters
value
VolumeValueThe value.
Returns
- VolumeValue
The largest integral value.
Foot(double)
Creates the VolumeValue struct with Foot
unit.
public static VolumeValue Foot(double value)
Parameters
value
doubleThe value.
Returns
- VolumeValue
The volume value.
Foot(NumberValue)
Creates the VolumeValue struct with Foot
unit.
public static VolumeValue Foot(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- VolumeValue
The volume value.
Frac(VolumeValue)
Returns the fractional part of the value number.
public static VolumeValue Frac(VolumeValue value)
Parameters
value
VolumeValueThe value number.
Returns
- VolumeValue
The fractional part.
Gallon(double)
Creates the VolumeValue struct with Gallon
unit.
public static VolumeValue Gallon(double value)
Parameters
value
doubleThe value.
Returns
- VolumeValue
The volume value.
Gallon(NumberValue)
Creates the VolumeValue struct with Gallon
unit.
public static VolumeValue Gallon(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- VolumeValue
The volume value.
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 VolumeValue struct with Inch
unit.
public static VolumeValue Inch(double value)
Parameters
value
doubleThe value.
Returns
- VolumeValue
The volume value.
Inch(NumberValue)
Creates the VolumeValue struct with Inch
unit.
public static VolumeValue Inch(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- VolumeValue
The volume value.
Liter(double)
Creates the VolumeValue struct with Liter
unit.
public static VolumeValue Liter(double value)
Parameters
value
doubleThe value.
Returns
- VolumeValue
The volume value.
Liter(NumberValue)
Creates the VolumeValue struct with Liter
unit.
public static VolumeValue Liter(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- VolumeValue
The volume value.
Meter(double)
Creates the VolumeValue struct with Meter
unit.
public static VolumeValue Meter(double value)
Parameters
value
doubleThe value.
Returns
- VolumeValue
The volume value.
Meter(NumberValue)
Creates the VolumeValue struct with Meter
unit.
public static VolumeValue Meter(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- VolumeValue
The volume value.
Round(VolumeValue, 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 VolumeValue Round(VolumeValue volumeValue, NumberValue digits)
Parameters
volumeValue
VolumeValueThe number.
digits
NumberValueThe number of fractional digits in the return value.
Returns
- VolumeValue
The number nearest to
volumeValue
that has a number of fractional digits equal todigits
. If value has fewer fractional digits thandigits
,volumeValue
is returned unchanged.
To(VolumeUnit)
Convert to the newUnit
unit.
public VolumeValue To(VolumeUnit newUnit)
Parameters
newUnit
VolumeUnitThe new unit.
Returns
- VolumeValue
The value in the new unit.
ToCentimeter()
Converts the value to the centimeter unit.
public VolumeValue ToCentimeter()
Returns
- VolumeValue
The value in centimeter unit.
ToFoot()
Converts the value to the foot unit.
public VolumeValue ToFoot()
Returns
- VolumeValue
The value in foot unit.
ToGallon()
Converts the value to the gallon unit.
public VolumeValue ToGallon()
Returns
- VolumeValue
The value in mile unit.
ToInch()
Converts the value to the inch unit.
public VolumeValue ToInch()
Returns
- VolumeValue
The value in inch unit.
ToLiter()
Converts the value to the liter unit.
public VolumeValue ToLiter()
Returns
- VolumeValue
The value in kilometer unit.
ToMeter()
Converts the value to the meter unit.
public VolumeValue ToMeter()
Returns
- VolumeValue
The value in meter 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 VolumeValue ToYard()
Returns
- VolumeValue
The value in yard unit.
Truncate(VolumeValue)
Calculates the integral part of a specified value number.
public static VolumeValue Truncate(VolumeValue value)
Parameters
value
VolumeValueAn value to truncate.
Returns
- VolumeValue
The integral part of value number.
Yard(double)
Creates the VolumeValue struct with Yard
unit.
public static VolumeValue Yard(double value)
Parameters
value
doubleThe value.
Returns
- VolumeValue
The volume value.
Yard(NumberValue)
Creates the VolumeValue struct with Yard
unit.
public static VolumeValue Yard(NumberValue value)
Parameters
value
NumberValueThe value.
Returns
- VolumeValue
The volume value.
Operators
operator +(VolumeValue, VolumeValue)
Adds two objects of VolumeValue.
public static VolumeValue operator +(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe first object to add.
right
VolumeValueThe second object to add.
Returns
- VolumeValue
An object that is the sum of
left
andright
.
operator ==(VolumeValue, VolumeValue)
Determines whether two specified instances of VolumeValue are equal.
public static bool operator ==(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe first object to compare.
right
VolumeValueThe second object to compare.
Returns
- bool
true
ifleft
is equal toright
; otherwise,false
.
operator >(VolumeValue, VolumeValue)
Indicates whether left
parameter is greater than the right
parameter.
public static bool operator >(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe left value.
right
VolumeValueThe right value.
Returns
- bool
true
if theleft
parameter is greater than theright
parameter; otherwise,false
.
operator >=(VolumeValue, VolumeValue)
Indicates whether left
parameter is greater than or equal to the right
parameter.
public static bool operator >=(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe left value.
right
VolumeValueThe right value.
Returns
- bool
true
if theleft
parameter is greater than or equal to theright
parameter; otherwise,false
.
operator !=(VolumeValue, VolumeValue)
Determines whether two specified instances of VolumeValue are equal.
public static bool operator !=(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe first object to compare.
right
VolumeValueThe second object to compare.
Returns
- bool
true
ifleft
is equal toright
; otherwise,false
.
operator <(VolumeValue, VolumeValue)
Indicates whether left
parameter is less than the right
parameter.
public static bool operator <(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe left value.
right
VolumeValueThe right value.
Returns
- bool
true
if theleft
parameter is less than theright
parameter; otherwise,false
.
operator <=(VolumeValue, VolumeValue)
Indicates whether left
parameter is less than or equal to the right
parameter.
public static bool operator <=(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe left value.
right
VolumeValueThe right value.
Returns
- bool
true
if theleft
parameter is less than or equal to theright
parameter; otherwise,false
.
operator -(VolumeValue, VolumeValue)
Subtracts two objects of VolumeValue.
public static VolumeValue operator -(VolumeValue left, VolumeValue right)
Parameters
left
VolumeValueThe first object to sub.
right
VolumeValueThe second object to sub.
Returns
- VolumeValue
An object that is the difference of
left
andright
.
operator -(VolumeValue)
Produces the negative of VolumeValue.
public static VolumeValue operator -(VolumeValue value)
Parameters
value
VolumeValueThe value.
Returns
- VolumeValue
The negative of
value
.