Table of Contents

Struct TemperatureValue

Namespace
xFunc.Maths.Expressions.Units.TemperatureUnits
Assembly
xFunc.Maths.dll

Represents a number with temperature unit.

public readonly struct TemperatureValue : IEquatable<TemperatureValue>, IComparable<TemperatureValue>, IComparable
Implements
Inherited Members

Constructors

TemperatureValue(NumberValue, TemperatureUnit)

Initializes a new instance of the TemperatureValue struct.

public TemperatureValue(NumberValue value, TemperatureUnit unit)

Parameters

value NumberValue

The value.

unit TemperatureUnit

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

double

Unit

Gets a unit.

public TemperatureUnit Unit { get; }

Property Value

TemperatureUnit

Value

Gets a value.

public NumberValue Value { get; }

Property Value

NumberValue

Methods

Abs(TemperatureValue)

Returns the absolute value of a specified temperature value.

public static TemperatureValue Abs(TemperatureValue value)

Parameters

value TemperatureValue

The temperature value.

Returns

TemperatureValue

The temperature value, x, that such that 0 ≤ xMaxValue.

AsExpression()

public Temperature AsExpression()

Returns

Temperature

The temperature number.

Ceiling(TemperatureValue)

Returns the smallest integral value that is greater than or equal to the specified temperature value.

public static TemperatureValue Ceiling(TemperatureValue value)

Parameters

value TemperatureValue

The temperature value.

Returns

TemperatureValue

The smallest integral value.

Celsius(double)

Creates the TemperatureValue struct with Celsius unit.

public static TemperatureValue Celsius(double value)

Parameters

value double

The value.

Returns

TemperatureValue

The temperature value.

Celsius(NumberValue)

Creates the TemperatureValue struct with Celsius unit.

public static TemperatureValue Celsius(NumberValue numberValue)

Parameters

numberValue NumberValue

The value.

Returns

TemperatureValue

The temperature 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 object

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 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(TemperatureValue)

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(TemperatureValue other)

Parameters

other TemperatureValue

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 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 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(TemperatureValue)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(TemperatureValue other)

Parameters

other TemperatureValue

An object to compare with this object.

Returns

bool

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

Fahrenheit(double)

Creates the TemperatureValue struct with Fahrenheit unit.

public static TemperatureValue Fahrenheit(double value)

Parameters

value double

The value.

Returns

TemperatureValue

The temperature value.

Fahrenheit(NumberValue)

Creates the TemperatureValue struct with Fahrenheit unit.

public static TemperatureValue Fahrenheit(NumberValue numberValue)

Parameters

numberValue NumberValue

The value.

Returns

TemperatureValue

The temperature value.

Floor(TemperatureValue)

Returns the largest integral value less than or equal to the specified temperature value number.

public static TemperatureValue Floor(TemperatureValue value)

Parameters

value TemperatureValue

The temperature value.

Returns

TemperatureValue

The largest integral value.

Frac(TemperatureValue)

Returns the fractional part of the temperature value number.

public static TemperatureValue Frac(TemperatureValue value)

Parameters

value TemperatureValue

The temperature value number.

Returns

TemperatureValue

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.

Kelvin(double)

Creates the TemperatureValue struct with Kelvin unit.

public static TemperatureValue Kelvin(double value)

Parameters

value double

The value.

Returns

TemperatureValue

The temperature value.

Kelvin(NumberValue)

Creates the TemperatureValue struct with Kelvin unit.

public static TemperatureValue Kelvin(NumberValue numberValue)

Parameters

numberValue NumberValue

The value.

Returns

TemperatureValue

The temperature value.

Round(TemperatureValue, 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 TemperatureValue Round(TemperatureValue temperatureValue, NumberValue digits)

Parameters

temperatureValue TemperatureValue

The temperature number.

digits NumberValue

The number of fractional digits in the return value.

Returns

TemperatureValue

The number nearest to temperatureValue that has a number of fractional digits equal to digits. If value has fewer fractional digits than digits, temperatureValue is returned unchanged.

To(TemperatureUnit)

Convert to the newUnit unit.

public TemperatureValue To(TemperatureUnit newUnit)

Parameters

newUnit TemperatureUnit

The new unit.

Returns

TemperatureValue

The value in the new unit.

ToCelsius()

Converts the current object to celsius.

public TemperatureValue ToCelsius()

Returns

TemperatureValue

The power value which is converted to celsius.

ToFahrenheit()

Converts the current object to fahrenheit.

public TemperatureValue ToFahrenheit()

Returns

TemperatureValue

The power value which is converted to fahrenheit.

ToKelvin()

Converts the current object to kelvin.

public TemperatureValue ToKelvin()

Returns

TemperatureValue

The power value which is converted to kelvin.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Truncate(TemperatureValue)

Calculates the integral part of a specified temperature value number.

public static TemperatureValue Truncate(TemperatureValue value)

Parameters

value TemperatureValue

An temperature value to truncate.

Returns

TemperatureValue

The integral part of temperature value number.

Operators

operator +(TemperatureValue, TemperatureValue)

Adds two objects of TemperatureValue.

public static TemperatureValue operator +(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The first object to add.

right TemperatureValue

The second object to add.

Returns

TemperatureValue

An object that is the sum of left and right.

operator ==(TemperatureValue, TemperatureValue)

Determines whether two specified instances of TemperatureValue are equal.

public static bool operator ==(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The first object to compare.

right TemperatureValue

The second object to compare.

Returns

bool

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

operator >(TemperatureValue, TemperatureValue)

Indicates whether left parameter is greater than the right parameter.

public static bool operator >(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The left power value.

right TemperatureValue

The right power value.

Returns

bool

true if the left parameter is greater than the right parameter; otherwise, false.

operator >=(TemperatureValue, TemperatureValue)

Indicates whether left parameter is greater than or equal to the right parameter.

public static bool operator >=(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The left power value.

right TemperatureValue

The right power value.

Returns

bool

true if the left parameter is greater than or equal to the right parameter; otherwise, false.

operator !=(TemperatureValue, TemperatureValue)

Determines whether two specified instances of TemperatureValue are not equal.

public static bool operator !=(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The first object to compare.

right TemperatureValue

The second object to compare.

Returns

bool

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

operator <(TemperatureValue, TemperatureValue)

Indicates whether left parameter is less than the right parameter.

public static bool operator <(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The left power value.

right TemperatureValue

The right power value.

Returns

bool

true if the left parameter is less than the right parameter; otherwise, false.

operator <=(TemperatureValue, TemperatureValue)

Indicates whether left parameter is less than or equal to the right parameter.

public static bool operator <=(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The left power value.

right TemperatureValue

The right power value.

Returns

bool

true if the left parameter is less than or equal to the right parameter; otherwise, false.

operator -(TemperatureValue, TemperatureValue)

Subtracts two objects of TemperatureValue.

public static TemperatureValue operator -(TemperatureValue left, TemperatureValue right)

Parameters

left TemperatureValue

The first object to sub.

right TemperatureValue

The second object to sub.

Returns

TemperatureValue

An object that is the difference of left and right.

operator -(TemperatureValue)

Produces the negative of TemperatureValue.

public static TemperatureValue operator -(TemperatureValue value)

Parameters

value TemperatureValue

The power value.

Returns

TemperatureValue

The negative of value.