Click or drag to resize

Mass Structure

Represents a mass measurement, in kilograms, as a double-precision floating-point number.
Inheritance Hierarchy
SystemObject
  SystemValueType
    GSF.UnitsMass

Namespace: GSF.Units
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
View Source

The Mass type exposes the following members.

Constructors
 NameDescription
Public methodMass Creates a new Mass.
Top
Methods
 NameDescription
Public methodCompareTo(Double) Compares this instance to a specified Double and returns an indication of their relative values.
Public methodCompareTo(Mass) Compares this instance to a specified Mass 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 Mass in kilograms.
Public methodConvertTo Converts the Mass to the specified targetUnit.
Public methodEquals(Double) Returns a value indicating whether this instance is equal to a specified Double value.
Public methodEquals(Mass) Returns a value indicating whether this instance is equal to a specified Mass value.
Public methodEquals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object))
Public methodStatic memberFromLongTons Creates a new Mass value from the specified value in long tons.
Public methodStatic memberFromMetricPounds Creates a new Mass value from the specified value in metric pounds.
Public methodStatic memberFromMetricTons Creates a new Mass value from the specified value in metric tons.
Public methodStatic memberFromOunces Creates a new Mass value from the specified value in ounces (avoirdupois).
Public methodStatic memberFromPounds Creates a new Mass value from the specified value in pounds (avoirdupois).
Public methodStatic memberFromTons Creates a new Mass value from the specified value in short tons.
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 Mass equivalent.
Public methodStatic memberParse(String, NumberStyles) Converts the string representation of a number in a specified style to its Mass equivalent.
Public methodStatic memberParse(String, IFormatProvider) Converts the string representation of a number in a specified culture-specific format to its Mass equivalent.
Public methodStatic memberParse(String, NumberStyles, IFormatProvider) Converts the string representation of a number in a specified style and culture-specific format to its Mass equivalent.
Public methodToLongTons Gets the Mass value in long tons.
Public methodToMetricPounds Gets the Mass value in metric pounds.
Public methodToMetricTons Gets the Mass value in metric tons.
Public methodToOunces Gets the Mass value in ounces (avoirdupois).
Public methodToPounds Gets the Mass value in pounds (avoirdupois).
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 methodToTons Gets the Mass value in short tons.
Public methodStatic memberTryParse(String, Mass) Converts the string representation of a number to its Mass equivalent. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(String, NumberStyles, IFormatProvider, Mass) Converts the string representation of a number in a specified style and culture-specific format to its Mass equivalent. A return value indicates whether the conversion succeeded or failed.
Top
Operators
 NameDescription
Public operatorStatic memberAddition(Mass, Mass) Returns computed sum of values.
Public operatorStatic memberDivision(Mass, Mass) Returns computed division of values.
Public operatorStatic memberEquality(Mass, Mass) Compares the two values for equality.
Public operatorStatic memberExponent(Mass, Mass) Returns result of first value raised to mass of second value.
Public operatorStatic memberGreaterThan(Mass, Mass) Returns true if left value is greater than right value.
Public operatorStatic memberGreaterThanOrEqual(Mass, Mass) Returns true if left value is greater than or equal to right value.
Public operatorStatic member(Double to Mass) Implicitly converts value, represented in kilograms, to a Mass.
Public operatorStatic member(Mass to Double) Implicitly converts Mass, represented in kilograms, to a Double.
Public operatorStatic memberInequality(Mass, Mass) Compares the two values for inequality.
Public operatorStatic memberLessThan(Mass, Mass) Returns true if left value is less than right value.
Public operatorStatic memberLessThanOrEqual(Mass, Mass) Returns true if left value is less or equal to than right value.
Public operatorStatic memberModulus(Mass, Mass) Returns computed remainder after dividing first value by the second.
Public operatorStatic memberMultiply(Mass, Mass) Returns computed product of values.
Public operatorStatic memberSubtraction(Mass, Mass) Returns computed difference of values.
Top
Fields
 NameDescription
Public fieldStatic memberMaxValueRepresents the largest possible value of an Mass. This field is constant.
Public fieldStatic memberMinValueRepresents the smallest possible value of an Mass. 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 a mass in kilograms; 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 mass representations, specifically ounces, pounds and tons. Metric conversions are handled simply by applying the needed SI conversion factor, for example:
Example
Convert mass, in kilograms, to grams:
C#
public double GetGrams(Mass kilograms)
{
    return kilograms * SI.Kilo;
}
This example converts tons to pounds:
C#
public double GetPounds(double tons)
{
    return Mass.FromTons(tons).ToPounds();
}
See Also