Length Structure

Represents a length measurement, in meters, 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    Length
Implements
IComparable, IComparableLength, IComparableDouble, IConvertible, IEquatableLength, IEquatableDouble, IFormattable

Remarks

This class behaves just like a Double representing a length in meters; 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 length representations, specifically inches, feet, yards, miles, U.S. survey feet, U.S. survey miles, light-seconds, and nautical miles. Metric conversions are handled simply by applying the needed SI conversion factor, for example:

Example

Convert length in meters to kilometers:
C#
public double GetKilometers(Length meters)
{
    return meters / SI.Kilo;
}
This example converts feet to inches:
C#
public double GetFeet(double inches)
{
    return Length.FromInches(inches).ToFeet();
}

Constructors

Length Creates a new Length.

Methods

CompareTo(Double) Compares this instance to a specified Double and returns an indication of their relative values.
CompareTo(Length) Compares this instance to a specified Length 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 Length in meters.
ConvertTo Converts the Length to the specified targetUnit.
Equals(Double) Returns a value indicating whether this instance is equal to a specified Double value.
Equals(Length) Returns a value indicating whether this instance is equal to a specified Length value.
Equals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object))
FromFeet Creates a new Length value from the specified value in feet.
FromInches Creates a new Length value from the specified value in inches.
FromLightSeconds Creates a new Length value from the specified value in light-seconds.
FromMiles Creates a new Length value from the specified value in miles.
FromNauticalMiles Creates a new Length value from the specified value in nautical miles.
FromUSSurveyFeet Creates a new Length value from the specified value in US survey feet.
FromUSSurveyMiles Creates a new Length value from the specified value in US survey miles.
FromYards Creates a new Length value from the specified value in yards.
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 Length equivalent.
Parse(String, NumberStyles) Converts the string representation of a number in a specified style to its Length equivalent.
Parse(String, IFormatProvider) Converts the string representation of a number in a specified culture-specific format to its Length equivalent.
Parse(String, NumberStyles, IFormatProvider) Converts the string representation of a number in a specified style and culture-specific format to its Length equivalent.
ToFeet Gets the Length value in feet.
ToInches Gets the Length value in inches.
ToLightSeconds Gets the Length value in light-seconds.
ToMiles Gets the Length value in miles.
ToNauticalMiles Gets the Length value in nautical miles.
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.
ToUSSurveyFeet Gets the Length value in US survey feet.
ToUSSurveyMiles Gets the Length value in US survey miles.
ToYards Gets the Length value in yards.
TryParse(String, Length) Converts the string representation of a number to its Length equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(String, NumberStyles, IFormatProvider, Length) Converts the string representation of a number in a specified style and culture-specific format to its Length equivalent. A return value indicates whether the conversion succeeded or failed.

Operators

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

Fields

MaxValueRepresents the largest possible value of an Length. This field is constant.
MinValueRepresents the smallest possible value of an Length. 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