|
|
Energy Structure |
[SerializableAttribute] public struct Energy : IComparable, IFormattable, IConvertible, IComparable<Energy>, IComparable<double>, IEquatable<Energy>, IEquatable<double>
The Energy type exposes the following members.
| Name | Description | |
|---|---|---|
| CompareTo(Double) | Compares this instance to a specified Double and returns an indication of their relative values. | |
| CompareTo(Energy) | Compares this instance to a specified Energy 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. | |
| ConvertFrom | Converts the value in the specified sourceUnit to a new Energy in joules. | |
| ConvertTo | Converts the Energy to the specified targetUnit. | |
| Equals(Double) | Returns a value indicating whether this instance is equal to a specified Double value. | |
| Equals(Energy) | Returns a value indicating whether this instance is equal to a specified Energy value. | |
| Equals(Object) |
Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object)) | |
| FromBarrelsOfOil | Creates a new Energy value from the specified value in equivalent barrels of oil. | |
| FromBTU | Creates a new Energy value from the specified value in BTU (International Table). | |
| FromCalories | Creates a new Energy value from the specified value in calories (International Table). | |
| FromCelsiusHeatUnits | Creates a new Energy value from the specified value in Celsius heat units (International Table). | |
| FromHorsepowerHours | Creates a new Energy value from the specified value in horsepower-hours. | |
| FromLitersAtmosphere | Creates a new Energy value from the specified value in liters-atmosphere. | |
| FromTonOfCoal | Creates a new Energy value from the specified value in equivalent tons of coal. | |
| FromWattHours | Creates a new Energy value from the specified value in watt-hours. | |
| GetHashCode |
Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode) | |
| GetType | Gets 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 Energy equivalent. | |
| Parse(String, NumberStyles) | Converts the string representation of a number in a specified style to its Energy equivalent. | |
| Parse(String, IFormatProvider) | Converts the string representation of a number in a specified culture-specific format to its Energy equivalent. | |
| Parse(String, NumberStyles, IFormatProvider) | Converts the string representation of a number in a specified style and culture-specific format to its Energy equivalent. | |
| ToBarrelsOfOil | Gets the Energy value in equivalent barrels of oil. | |
| ToBTU | Gets the Energy value in BTU (International Table). | |
| ToCalories | Gets the Energy value in calories (International Table). | |
| ToCelsiusHeatUnits | Gets the Energy value in Celsius heat units (International Table). | |
| ToCoulombs | Gets the Charge value in coulombs given the specified volts. | |
| ToHorsepowerHours | Gets the Energy value in horsepower-hours. | |
| ToLitersAtmosphere | Gets the Energy value in liters-atmosphere. | |
| 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. | |
| ToTonsOfCoal | Gets the Energy value in equivalent tons of coal. | |
| ToWattHours | Gets the Energy value in watt-hours. | |
| TryParse(String, Energy) | Converts the string representation of a number to its Energy equivalent. A return value indicates whether the conversion succeeded or failed. | |
| TryParse(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. |
| Name | Description | |
|---|---|---|
| Addition(Energy, Energy) | Returns computed sum of values. | |
| Division(Energy, Energy) | Returns computed division of values. | |
| Equality(Energy, Energy) | Compares the two values for equality. | |
| Exponent(Energy, Energy) | Returns result of first value raised to power of second value. | |
| GreaterThan(Energy, Energy) | Returns true if left value is greater than right value. | |
| GreaterThanOrEqual(Energy, Energy) | Returns true if left value is greater than or equal to right value. | |
| (Double to Energy) | Implicitly converts value, represented in joules, to an Energy. | |
| (Energy to Double) | Implicitly converts Energy, represented in joules, to a Double. | |
| Inequality(Energy, Energy) | Compares the two values for inequality. | |
| LessThan(Energy, Energy) | Returns true if left value is less than right value. | |
| LessThanOrEqual(Energy, Energy) | Returns true if left value is less or equal to than right value. | |
| Modulus(Energy, Energy) | Returns computed remainder after dividing first value by the second. | |
| Multiply(Energy, Energy) | Returns computed product of values. | |
| Subtraction(Energy, Energy) | Returns computed difference of values. |
| Name | Description | |
|---|---|---|
| MaxValue | Represents the largest possible value of an Energy. This field is constant. | |
| MinValue | Represents the smallest possible value of an Energy. This field is constant. |
| Name | Description | |
|---|---|---|
| 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) |
public double GetMegajoules(Energy joules) { return joules / SI.Mega; }
public double GetKilowattHours(double megajoules) { return (new Energy(megajoules * SI.Mega)).ToWattHours() / SI.Kilo; }
public double GetMegawattHours(double kilowattHours) { return (kilowattHours * SI.Kilo) / SI.Mega; }