Table of Contents

Struct TemperatureUnit

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

Represents a temperature unit.

public readonly struct TemperatureUnit : IEquatable<TemperatureUnit>
Implements
Inherited Members

Fields

Celsius

Celsius (°C).

public static readonly TemperatureUnit Celsius

Field Value

TemperatureUnit

Fahrenheit

Fahrenheit (°F).

public static readonly TemperatureUnit Fahrenheit

Field Value

TemperatureUnit

Kelvin

Kelvin (K).

public static readonly TemperatureUnit Kelvin

Field Value

TemperatureUnit

Properties

FromBase

Gets the conversion function from the base unit to the current unit.

public Func<double, double> FromBase { get; }

Property Value

Func<double, double>

Names

Gets all available unit names.

public static IEnumerable<string> Names { get; }

Property Value

IEnumerable<string>

ToBase

Gets the conversion function from the current unit to the base unit.

public Func<double, double> ToBase { get; }

Property Value

Func<double, double>

UnitName

Gets a short name of the unit.

public string UnitName { get; }

Property Value

string

Units

Gets all available units.

public static IEnumerable<TemperatureUnit> Units { get; }

Property Value

IEnumerable<TemperatureUnit>

Methods

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

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

public bool Equals(TemperatureUnit other)

Parameters

other TemperatureUnit

An object to compare with this object.

Returns

bool

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

FromName(string, out TemperatureUnit)

Gets a unit by name.

public static bool FromName(string name, out TemperatureUnit unit)

Parameters

name string

The name of unit.

unit TemperatureUnit

When this method returns, the value associated with the specified name, if the unit is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

bool

true if temperature units contain an unit with the specified name; otherwise, false.

Exceptions

ArgumentNullException

name is null.

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.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(TemperatureUnit, TemperatureUnit)

Determines whether two specified instances of TemperatureUnit are equal.

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

Parameters

left TemperatureUnit

The first object to compare.

right TemperatureUnit

The second object to compare.

Returns

bool

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

operator !=(TemperatureUnit, TemperatureUnit)

Determines whether two specified instances of TemperatureUnit are equal.

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

Parameters

left TemperatureUnit

The first object to compare.

right TemperatureUnit

The second object to compare.

Returns

bool

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