Class Conversion
This static class provides a conversion method to go to and from different units.
public static class Conversion
- Inheritance
-
Conversion
- Inherited Members
Remarks
None
Methods
ConvertAngleUnits(double, AngleUnit, AngleUnit)
public static double ConvertAngleUnits(double angle, AngleUnit fromUnit, AngleUnit toUnit)
Parameters
Returns
ConvertGeographyUnitToDistanceUnit(GeographyUnit)
This method returns a DistanceUnit that has been converted from a GeographyUnit.
public static DistanceUnit ConvertGeographyUnitToDistanceUnit(GeographyUnit unit)
Parameters
unit
GeographyUnitThe GeographyUnit you want to convert.
Returns
- DistanceUnit
This method returns a DistanceUnit that has been converted from a GeographyUnit.
Remarks
None
Exceptions
- ArgumentOutOfRangeException
If you pass in a GeographyUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.
ConvertMeasureUnits(double, AreaUnit, AreaUnit)
This method converts from one unit of measure to another.
public static double ConvertMeasureUnits(double amount, AreaUnit fromUnit, AreaUnit toUnit)
Parameters
amount
doubleThe total area size, represented in the unit specified in the fromUnit parameter.
fromUnit
AreaUnitThe unit of measure for the area in the Amount parameter.
toUnit
AreaUnitThe unit of measure for the result.
Returns
- double
The return area size, represented in the unit specified in the toUnit parameter.
Remarks
None
Exceptions
- ArgumentOutOfRangeException
If you pass in a fromUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a toUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.
ConvertMeasureUnits(double, DistanceUnit, DistanceUnit)
This method converts from one unit of measure to another.
public static double ConvertMeasureUnits(double amount, DistanceUnit fromUnit, DistanceUnit toUnit)
Parameters
amount
doubleThe total length size, represented in the unit specified in the fromUnit parameter.
fromUnit
DistanceUnitThe unit of measure for the length in the Amount parameter.
toUnit
DistanceUnitThe unit of measure for the result.
Returns
- double
The return length size, represented in the unit specified in the toUnit parameter.
Remarks
None
Exceptions
- ArgumentOutOfRangeException
If you pass in a fromUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.
- ArgumentOutOfRangeException
If you pass in a toUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.