Click or drag to resize

Length Structure

Represents a length measurement, in meters, as a double-precision floating-point number.
Inheritance Hierarchy
SystemObject
  SystemValueType
    GSF.UnitsLength

Namespace: GSF.Units
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax
View Source

The Length type exposes the following members.

Constructors
 NameDescription
Public methodLength Creates a new Length.
Top
Methods
 NameDescription
Public methodCompareTo(Double) Compares this instance to a specified Double and returns an indication of their relative values.
Public methodCompareTo(Length) Compares this instance to a specified Length 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 Length in meters.
Public methodConvertTo Converts the Length to the specified targetUnit.
Public methodEquals(Double) Returns a value indicating whether this instance is equal to a specified Double value.
Public methodEquals(Length) Returns a value indicating whether this instance is equal to a specified Length value.
Public methodEquals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object))
Public methodStatic memberFromFeet Creates a new Length value from the specified value in feet.
Public methodStatic memberFromInches Creates a new Length value from the specified value in inches.
Public methodStatic memberFromLightSeconds Creates a new Length value from the specified value in light-seconds.
Public methodStatic memberFromMiles Creates a new Length value from the specified value in miles.
Public methodStatic memberFromNauticalMiles Creates a new Length value from the specified value in nautical miles.
Public methodStatic memberFromUSSurveyFeet Creates a new Length value from the specified value in US survey feet.
Public methodStatic memberFromUSSurveyMiles Creates a new Length value from the specified value in US survey miles.
Public methodStatic memberFromYards Creates a new Length value from the specified value in yards.
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 Length equivalent.
Public methodStatic memberParse(String, NumberStyles) Converts the string representation of a number in a specified style to its Length equivalent.
Public methodStatic memberParse(String, IFormatProvider) Converts the string representation of a number in a specified culture-specific format to its Length equivalent.
Public methodStatic memberParse(String, NumberStyles, IFormatProvider) Converts the string representation of a number in a specified style and culture-specific format to its Length equivalent.
Public methodToFeet Gets the Length value in feet.
Public methodToInches Gets the Length value in inches.
Public methodToLightSeconds Gets the Length value in light-seconds.
Public methodToMiles Gets the Length value in miles.
Public methodToNauticalMiles Gets the Length value in nautical miles.
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 methodToUSSurveyFeet Gets the Length value in US survey feet.
Public methodToUSSurveyMiles Gets the Length value in US survey miles.
Public methodToYards Gets the Length value in yards.
Public methodStatic memberTryParse(String, Length) Converts the string representation of a number to its Length equivalent. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(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.
Top
Operators
 NameDescription
Public operatorStatic memberAddition(Length, Length) Returns computed sum of values.
Public operatorStatic memberDivision(Length, Length) Returns computed division of values.
Public operatorStatic memberEquality(Length, Length) Compares the two values for equality.
Public operatorStatic memberExponent(Length, Length) Returns result of first value raised to power of second value.
Public operatorStatic memberGreaterThan(Length, Length) Returns true if left value is greater than right value.
Public operatorStatic memberGreaterThanOrEqual(Length, Length) Returns true if left value is greater than or equal to right value.
Public operatorStatic member(Double to Length) Implicitly converts value, represented in meters, to a Length.
Public operatorStatic member(Length to Double) Implicitly converts Length, represented in meters, to a Double.
Public operatorStatic memberInequality(Length, Length) Compares the two values for inequality.
Public operatorStatic memberLessThan(Length, Length) Returns true if left value is less than right value.
Public operatorStatic memberLessThanOrEqual(Length, Length) Returns true if left value is less or equal to than right value.
Public operatorStatic memberModulus(Length, Length) Returns computed remainder after dividing first value by the second.
Public operatorStatic memberMultiply(Length, Length) Returns computed product of values.
Public operatorStatic memberSubtraction(Length, Length) Returns computed difference of values.
Top
Fields
 NameDescription
Public fieldStatic memberMaxValueRepresents the largest possible value of an Length. This field is constant.
Public fieldStatic memberMinValueRepresents the smallest possible value of an Length. 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 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();
}
See Also