Provides unit conversion functionality
UnitConverter
01 Syntax
Emily.eQuilibrator.Core.Models.UnitConverter
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| GetConversionFactor | 1 | Gets the conversion factor from one unit to another |
| CanConvert | 1 | Checks if conversion between two units is supported |
| RegisterConversion | 1 | Registers a new conversion factor |
03 Members
GetConversionFactor(
String, String)Gets the conversion factor from one unit to another
Parameters
| Name | Type | Description |
|---|---|---|
fromUnit | String | Source unit |
toUnit | String | Target unit |
Returns
Conversion factor
CanConvert(
String, String)Checks if conversion between two units is supported
Parameters
| Name | Type | Description |
|---|---|---|
fromUnit | String | Source unit |
toUnit | String | Target unit |
Returns
True if conversion is supported
RegisterConversion(
String, String, Double)Registers a new conversion factor
Parameters
| Name | Type | Description |
|---|---|---|
fromUnit | String | Source unit |
toUnit | String | Target unit |
factor | Double | Conversion factor |