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
Fahrenheit
Fahrenheit (°F).
public static readonly TemperatureUnit Fahrenheit
Field Value
Kelvin
Kelvin (K).
public static readonly TemperatureUnit Kelvin
Field Value
Properties
FromBase
Gets the conversion function from the base unit to the current unit.
public Func<double, double> FromBase { get; }
Property Value
Names
Gets all available unit names.
public static IEnumerable<string> Names { get; }
Property Value
ToBase
Gets the conversion function from the current unit to the base unit.
public Func<double, double> ToBase { get; }
Property Value
UnitName
Gets a short name of the unit.
public string UnitName { get; }
Property Value
Units
Gets all available units.
[ExcludeFromCodeCoverage]
public static IEnumerable<TemperatureUnit> Units { get; }
Property Value
Methods
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(TemperatureUnit)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(TemperatureUnit other)
Parameters
otherTemperatureUnitAn object to compare with this object.
Returns
FromName(string, out TemperatureUnit)
Gets a unit by name.
public static bool FromName(string name, out TemperatureUnit unit)
Parameters
namestringThe name of unit.
unitTemperatureUnitWhen 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
trueif temperature units contain an unit with the specifiedname; otherwise,false.
Exceptions
- ArgumentNullException
nameisnull.
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.
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
leftTemperatureUnitThe first object to compare.
rightTemperatureUnitThe second object to compare.
Returns
- bool
trueifleftis equal toright; otherwise,false.
operator !=(TemperatureUnit, TemperatureUnit)
Determines whether two specified instances of TemperatureUnit are equal.
public static bool operator !=(TemperatureUnit left, TemperatureUnit right)
Parameters
leftTemperatureUnitThe first object to compare.
rightTemperatureUnitThe second object to compare.
Returns
- bool
trueifleftis equal toright; otherwise,false.