Distance Structure |
The Distance type exposes the following members.
| Name | Description | |
|---|---|---|
| Distance | Constructs a new Distance with the specified value and unit of measurement. |
| Name | Description | |
|---|---|---|
| Unit | Gets the unit of measurement of this Distance. | |
| Value | Gets the numeric value of this Distance. |
| Name | Description | |
|---|---|---|
| Equals(Distance) | Returns true if other has an equal unit and an equal value. | |
| Equals(Object) |
Returns true if obj is a Distance
with an equal unit and an equal value.
(Overrides ValueTypeEquals(Object)) | |
| Feet | Returns a Distance with the specified value and Feet as the unit of measurement. | |
| GetHashCode |
Overridden to ensure consistency with Equals.
(Overrides ValueTypeGetHashCode) | |
| In | Returns a Distance that represents this Distance converted into the specified unit of measurement. | |
| InFeet | Returns a Distance that represents this Distance converted into feet. | |
| InKilometres | Returns a Distance that represents this Distance converted into kilometres. | |
| InMetres | Returns a Distance that represents this Distance converted into metres. | |
| InMiles | Returns a Distance that represents this Distance converted into miles. | |
| Int32Value | Returns the distance value, rounded to the nearest integer. | |
| Kilometres | Returns a Distance with the specified value and Kilometres as the unit of measurement. | |
| Metres | Returns a Distance with the specified value and Metres as the unit of measurement. | |
| Miles | Returns a Distance with the specified value and Miles as the unit of measurement. | |
| ToString |
Returns a non-null, non-empty string representation of this instance for logging and debugging purposes.
(Overrides ValueTypeToString) |
| Name | Description | |
|---|---|---|
| Equality(Distance, Distance) | Determines whether two specified Distance instances are equal. | |
| Inequality(Distance, Distance) | Determines whether two specified Distance instances are not equal. |
To create a Distance, it's usually easiest to use the static factory methods: Metres(Double), Kilometres(Double), Feet(Double), and Miles(Double). For example:
It's easy to convert between units: