Power Structure

Represents a power measurement, in watts, as a double-precision floating-point number.

Definition

Namespace: Gemstone.Units
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.110 -- Release Build+3e0464f4461df4d3e1175b13966eb47ff832554d
Inheritance
Object    ValueType    Power
Implements
IComparable, IComparablePower, IComparableDouble, IConvertible, IEquatablePower, IEquatableDouble, IFormattable

Remarks

This class behaves just like a Double representing a power in watts; it is implicitly castable to and from a Double and therefore can be generally used "as" a double, but it has the advantage of handling conversions to and from other power representations, specifically horsepower, metric horsepower, boiler horsepower, BTU per second, calorie per second, and liter-atmosphere per second. Metric conversions are handled simply by applying the needed SI conversion factor, for example:

Example

Convert power in watts to megawatts:
C#
public double GetMegawatts(Power watts)
{
    return watts / SI.Mega;
}
This example converts megawatts to mechanical horsepower:
C#
public double GetHorsepower(double megawatts)
{
    return (new Power(megawatts * SI.Mega)).ToHorsepower();
}

Constructors

Power Creates a new Power.

Methods

CompareTo(Double) Compares this instance to a specified Double and returns an indication of their relative values.
CompareTo(Object) Compares this instance to a specified object and returns an indication of their relative values.
CompareTo(Power) Compares this instance to a specified Power and returns an indication of their relative values.
ConvertFrom Converts the value in the specified sourceUnit to a new Power in watts.
ConvertTo Converts the Power to the specified targetUnit.
Equals(Double) Returns a value indicating whether this instance is equal to a specified Double value.
Equals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object))
Equals(Power) Returns a value indicating whether this instance is equal to a specified Power value.
FromBoilerHorsepower Creates a new Power value from the specified value in boiler horsepower.
FromBTUPerSecond Creates a new Power value from the specified value in BTU (International Table) per second.
FromCaloriesPerSecond Creates a new Power value from the specified value in calories (International Table) per second.
FromHorsepower Creates a new Power value from the specified value in mechanical horsepower (Imperial).
FromLitersAtmospherePerSecond Creates a new Power value from the specified value in liters-atmosphere per second.
FromMetricHorsepower Creates a new Power value from the specified value in metric horsepower.
GetHashCode Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetTypeCode Returns the TypeCode for value type Double.
Parse(String) Converts the string representation of a number to its Power equivalent.
Parse(String, NumberStyles) Converts the string representation of a number in a specified style to its Power equivalent.
Parse(String, IFormatProvider) Converts the string representation of a number in a specified culture-specific format to its Power equivalent.
Parse(String, NumberStyles, IFormatProvider) Converts the string representation of a number in a specified style and culture-specific format to its Power equivalent.
ToBoilerHorsepower Gets the Power value in boiler horsepower.
ToBTUPerSecond Gets the Power value in BTU (International Table) per second.
ToCaloriesPerSecond Gets the Power value in calories (International Table) per second.
ToHorsepower Gets the Power value in mechanical horsepower (Imperial).
ToLitersAtmospherePerSecond Gets the Power value in liters-atmosphere per second.
ToMetricHorsepower Gets the Power value in metric horsepower.
ToString Converts the numeric value of this instance to its equivalent string representation.
(Overrides ValueTypeToString)
ToString(IFormatProvider) Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
ToString(String) Converts the numeric value of this instance to its equivalent string representation, using the specified format.
ToString(String, IFormatProvider) Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
TryParse(String, Power) Converts the string representation of a number to its Power equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(String, NumberStyles, IFormatProvider, Power) Converts the string representation of a number in a specified style and culture-specific format to its Power equivalent. A return value indicates whether the conversion succeeded or failed.

Operators

Addition(Power, Power) Returns computed sum of values.
Division(Power, Power) Returns computed division of values.
Equality(Power, Power) Compares the two values for equality.
Exponent(Power, Power) Returns result of first value raised to power of second value.
GreaterThan(Power, Power) Returns true if left value is greater than right value.
GreaterThanOrEqual(Power, Power) Returns true if left value is greater than or equal to right value.
(Double to Power) Implicitly converts value, represented in watts, to a Power.
(Power to Double) Implicitly converts Power, represented in watts, to a Double.
Inequality(Power, Power) Compares the two values for inequality.
LessThan(Power, Power) Returns true if left value is less than right value.
LessThanOrEqual(Power, Power) Returns true if left value is less or equal to than right value.
Modulus(Power, Power) Returns computed remainder after dividing first value by the second.
Multiply(Power, Power) Returns computed product of values.
Subtraction(Power, Power) Returns computed difference of values.

Fields

MaxValueRepresents the largest possible value of an Power. This field is constant.
MinValueRepresents the smallest possible value of an Power. This field is constant.

Extension Methods

GetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
GetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)

See Also