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
valueNumberValueThe value.
unitVolumeUnitThe 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
valueVolumeValueThe 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
valueVolumeValueThe value.
Returns
- VolumeValue
The smallest integral value.
Centimeter(double)
Creates the VolumeValue struct with Centimeter unit.
public static VolumeValue Centimeter(double value)
Parameters
valuedoubleThe value.
Returns
- VolumeValue
The volume value.
Centimeter(NumberValue)
Creates the VolumeValue struct with Centimeter unit.
public static VolumeValue Centimeter(NumberValue value)
Parameters
valueNumberValueThe 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
objobjectAn 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(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
otherVolumeValueAn 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.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe 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(VolumeValue)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(VolumeValue other)
Parameters
otherVolumeValueAn 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
valueVolumeValueThe value.
Returns
- VolumeValue
The largest integral value.
Foot(double)
Creates the VolumeValue struct with Foot unit.
public static VolumeValue Foot(double value)
Parameters
valuedoubleThe value.
Returns
- VolumeValue
The volume value.
Foot(NumberValue)
Creates the VolumeValue struct with Foot unit.
public static VolumeValue Foot(NumberValue value)
Parameters
valueNumberValueThe value.
Returns
- VolumeValue
The volume value.
Frac(VolumeValue)
Returns the fractional part of the value number.
public static VolumeValue Frac(VolumeValue value)
Parameters
valueVolumeValueThe value number.
Returns
- VolumeValue
The fractional part.
Gallon(double)
Creates the VolumeValue struct with Gallon unit.
public static VolumeValue Gallon(double value)
Parameters
valuedoubleThe value.
Returns
- VolumeValue
The volume value.
Gallon(NumberValue)
Creates the VolumeValue struct with Gallon unit.
public static VolumeValue Gallon(NumberValue value)
Parameters
valueNumberValueThe value.
Returns
- VolumeValue
The volume value.
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 VolumeValue struct with Inch unit.
public static VolumeValue Inch(double value)
Parameters
valuedoubleThe value.
Returns
- VolumeValue
The volume value.
Inch(NumberValue)
Creates the VolumeValue struct with Inch unit.
public static VolumeValue Inch(NumberValue value)
Parameters
valueNumberValueThe value.
Returns
- VolumeValue
The volume value.
Liter(double)
Creates the VolumeValue struct with Liter unit.
public static VolumeValue Liter(double value)
Parameters
valuedoubleThe value.
Returns
- VolumeValue
The volume value.
Liter(NumberValue)
Creates the VolumeValue struct with Liter unit.
public static VolumeValue Liter(NumberValue value)
Parameters
valueNumberValueThe value.
Returns
- VolumeValue
The volume value.
Meter(double)
Creates the VolumeValue struct with Meter unit.
public static VolumeValue Meter(double value)
Parameters
valuedoubleThe value.
Returns
- VolumeValue
The volume value.
Meter(NumberValue)
Creates the VolumeValue struct with Meter unit.
public static VolumeValue Meter(NumberValue value)
Parameters
valueNumberValueThe 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
volumeValueVolumeValueThe number.
digitsNumberValueThe number of fractional digits in the return value.
Returns
- VolumeValue
The number nearest to
volumeValuethat has a number of fractional digits equal todigits. If value has fewer fractional digits thandigits,volumeValueis returned unchanged.
To(VolumeUnit)
Convert to the newUnit unit.
public VolumeValue To(VolumeUnit newUnit)
Parameters
newUnitVolumeUnitThe 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
valueVolumeValueAn 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
valuedoubleThe value.
Returns
- VolumeValue
The volume value.
Yard(NumberValue)
Creates the VolumeValue struct with Yard unit.
public static VolumeValue Yard(NumberValue value)
Parameters
valueNumberValueThe value.
Returns
- VolumeValue
The volume value.
Operators
operator +(VolumeValue, VolumeValue)
Adds two objects of VolumeValue.
public static VolumeValue operator +(VolumeValue left, VolumeValue right)
Parameters
leftVolumeValueThe first object to add.
rightVolumeValueThe second object to add.
Returns
- VolumeValue
An object that is the sum of
leftandright.
operator ==(VolumeValue, VolumeValue)
Determines whether two specified instances of VolumeValue are equal.
public static bool operator ==(VolumeValue left, VolumeValue right)
Parameters
leftVolumeValueThe first object to compare.
rightVolumeValueThe second object to compare.
Returns
- bool
trueifleftis 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
leftVolumeValueThe left value.
rightVolumeValueThe right value.
Returns
- bool
trueif theleftparameter is greater than therightparameter; 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
leftVolumeValueThe left value.
rightVolumeValueThe right value.
Returns
- bool
trueif theleftparameter is greater than or equal to therightparameter; otherwise,false.
operator !=(VolumeValue, VolumeValue)
Determines whether two specified instances of VolumeValue are equal.
public static bool operator !=(VolumeValue left, VolumeValue right)
Parameters
leftVolumeValueThe first object to compare.
rightVolumeValueThe second object to compare.
Returns
- bool
trueifleftis 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
leftVolumeValueThe left value.
rightVolumeValueThe right value.
Returns
- bool
trueif theleftparameter is less than therightparameter; 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
leftVolumeValueThe left value.
rightVolumeValueThe right value.
Returns
- bool
trueif theleftparameter is less than or equal to therightparameter; otherwise,false.
operator -(VolumeValue, VolumeValue)
Subtracts two objects of VolumeValue.
public static VolumeValue operator -(VolumeValue left, VolumeValue right)
Parameters
leftVolumeValueThe first object to sub.
rightVolumeValueThe second object to sub.
Returns
- VolumeValue
An object that is the difference of
leftandright.
operator -(VolumeValue)
Produces the negative of VolumeValue.
public static VolumeValue operator -(VolumeValue value)
Parameters
valueVolumeValueThe value.
Returns
- VolumeValue
The negative of
value.