Click or drag to resize

Energy Structure

Represents an energy measurement, in joules (i.e., watt-seconds), as a double-precision floating-point number.
Inheritance Hierarchy
SystemObject
  SystemValueType
    GSF.UnitsEnergy

Namespace: GSF.Units
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
View Source

The Energy type exposes the following members.

Constructors
 NameDescription
Public methodEnergy Creates a new Energy.
Top
Methods
 NameDescription
Public methodCompareTo(Double) Compares this instance to a specified Double and returns an indication of their relative values.
Public methodCompareTo(Energy) Compares this instance to a specified Energy and returns an indication of their relative values.
Public methodCompareTo(Object) Compares this instance to a specified object and returns an indication of their relative values.
Public methodStatic memberConvertFrom Converts the value in the specified sourceUnit to a new Energy in joules.
Public methodConvertTo Converts the Energy to the specified targetUnit.
Public methodEquals(Double) Returns a value indicating whether this instance is equal to a specified Double value.
Public methodEquals(Energy) Returns a value indicating whether this instance is equal to a specified Energy value.
Public methodEquals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object))
Public methodStatic memberFromBarrelsOfOil Creates a new Energy value from the specified value in equivalent barrels of oil.
Public methodStatic memberFromBTU Creates a new Energy value from the specified value in BTU (International Table).
Public methodStatic memberFromCalories Creates a new Energy value from the specified value in calories (International Table).
Public methodStatic memberFromCelsiusHeatUnits Creates a new Energy value from the specified value in Celsius heat units (International Table).
Public methodStatic memberFromHorsepowerHours Creates a new Energy value from the specified value in horsepower-hours.
Public methodStatic memberFromLitersAtmosphere Creates a new Energy value from the specified value in liters-atmosphere.
Public methodStatic memberFromTonOfCoal Creates a new Energy value from the specified value in equivalent tons of coal.
Public methodStatic memberFromWattHours Creates a new Energy value from the specified value in watt-hours.
Public methodGetHashCode Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetTypeCode Returns the TypeCode for value type Double.
Public methodStatic memberParse(String) Converts the string representation of a number to its Energy equivalent.
Public methodStatic memberParse(String, NumberStyles) Converts the string representation of a number in a specified style to its Energy equivalent.
Public methodStatic memberParse(String, IFormatProvider) Converts the string representation of a number in a specified culture-specific format to its Energy equivalent.
Public methodStatic memberParse(String, NumberStyles, IFormatProvider) Converts the string representation of a number in a specified style and culture-specific format to its Energy equivalent.
Public methodToBarrelsOfOil Gets the Energy value in equivalent barrels of oil.
Public methodToBTU Gets the Energy value in BTU (International Table).
Public methodToCalories Gets the Energy value in calories (International Table).
Public methodToCelsiusHeatUnits Gets the Energy value in Celsius heat units (International Table).
Public methodToCoulombs Gets the Charge value in coulombs given the specified volts.
Public methodToHorsepowerHours Gets the Energy value in horsepower-hours.
Public methodToLitersAtmosphere Gets the Energy value in liters-atmosphere.
Public methodToString Converts the numeric value of this instance to its equivalent string representation.
(Overrides ValueTypeToString)
Public methodToString(IFormatProvider) Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
Public methodToString(String) Converts the numeric value of this instance to its equivalent string representation, using the specified format.
Public methodToString(String, IFormatProvider) Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
Public methodToTonsOfCoal Gets the Energy value in equivalent tons of coal.
Public methodToWattHours Gets the Energy value in watt-hours.
Public methodStatic memberTryParse(String, Energy) Converts the string representation of a number to its Energy equivalent. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(String, NumberStyles, IFormatProvider, Energy) Converts the string representation of a number in a specified style and culture-specific format to its Energy equivalent. A return value indicates whether the conversion succeeded or failed.
Top
Operators
 NameDescription
Public operatorStatic memberAddition(Energy, Energy) Returns computed sum of values.
Public operatorStatic memberDivision(Energy, Energy) Returns computed division of values.
Public operatorStatic memberEquality(Energy, Energy) Compares the two values for equality.
Public operatorStatic memberExponent(Energy, Energy) Returns result of first value raised to power of second value.
Public operatorStatic memberGreaterThan(Energy, Energy) Returns true if left value is greater than right value.
Public operatorStatic memberGreaterThanOrEqual(Energy, Energy) Returns true if left value is greater than or equal to right value.
Public operatorStatic member(Double to Energy) Implicitly converts value, represented in joules, to an Energy.
Public operatorStatic member(Energy to Double) Implicitly converts Energy, represented in joules, to a Double.
Public operatorStatic memberInequality(Energy, Energy) Compares the two values for inequality.
Public operatorStatic memberLessThan(Energy, Energy) Returns true if left value is less than right value.
Public operatorStatic memberLessThanOrEqual(Energy, Energy) Returns true if left value is less or equal to than right value.
Public operatorStatic memberModulus(Energy, Energy) Returns computed remainder after dividing first value by the second.
Public operatorStatic memberMultiply(Energy, Energy) Returns computed product of values.
Public operatorStatic memberSubtraction(Energy, Energy) Returns computed difference of values.
Top
Fields
 NameDescription
Public fieldStatic memberMaxValueRepresents the largest possible value of an Energy. This field is constant.
Public fieldStatic memberMinValueRepresents the smallest possible value of an Energy. This field is constant.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks
This class behaves just like a Double representing an energy in joules; 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 energy representations, specifically watt-hours, BTU, Celsius heat unit, liter-atmosphere, calorie, horsepower-hour, barrel of oil and ton of coal. Metric conversions are handled simply by applying the needed SI conversion factor, for example:
Example
Convert energy in joules to megajoules:
C#
public double GetMegajoules(Energy joules)
{
    return joules / SI.Mega;
}
This example converts megajoules to kilowatt-hours:
C#
public double GetKilowattHours(double megajoules)
{
    return (new Energy(megajoules * SI.Mega)).ToWattHours() / SI.Kilo;
}
This example converts kilowatt-hours to megawatt-hours:
C#
public double GetMegawattHours(double kilowattHours)
{
    return (kilowattHours * SI.Kilo) / SI.Mega;
}
See Also