Table of Contents

Struct PowerUnit

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

Represents a power unit.

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

Fields

Horsepower

Horsepower (hp).

public static readonly PowerUnit Horsepower

Field Value

PowerUnit

Kilowatt

Kilowatt (kW).

public static readonly PowerUnit Kilowatt

Field Value

PowerUnit

Watt

Watt (W).

public static readonly PowerUnit Watt

Field Value

PowerUnit

Properties

Factor

Gets a factor of conversion from this unit to base unit.

public double Factor { get; }

Property Value

double

Names

Gets all available unit names.

public static IEnumerable<string> Names { get; }

Property Value

IEnumerable<string>

UnitName

Gets a short name of the unit.

public string UnitName { get; }

Property Value

string

Units

Gets all available units.

public static IEnumerable<PowerUnit> Units { get; }

Property Value

IEnumerable<PowerUnit>

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

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

public bool Equals(PowerUnit other)

Parameters

other PowerUnit

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 PowerUnit)

Gets a unit by name.

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

Parameters

name string

The name of unit.

unit PowerUnit

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 power 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 ==(PowerUnit, PowerUnit)

Determines whether two specified instances of PowerUnit are equal.

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

Parameters

left PowerUnit

The first object to compare.

right PowerUnit

The second object to compare.

Returns

bool

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

operator !=(PowerUnit, PowerUnit)

Determines whether two specified instances of PowerUnit are equal.

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

Parameters

left PowerUnit

The first object to compare.

right PowerUnit

The second object to compare.

Returns

bool

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