readonly struct DecimalMeasurement<T>
Parents | |
|
|
|
|
|
|
|
The class to manipulate measurements expressed in the specified units.
Parameters | |
T |
The unit of the measurement (e.g. length, weight) is defined as the parameter of this generic structure.
The enumeration used as a measurement units specification must be marked using UnitAttribute
and
ConversionAttribute
The arithmetic operators (e.g. +
, *
) and comparison operators are supported.
The class supports serialization using System.Text.Json
serializer and XmlSerializer
as well as
many 3rd party serializers such as BinaronSerializer
.
Static Public Properties | |
The base unit for the measurement |
|
The value with a zero measurement |
Static Public Methods | |
Convert value from one unit to another |
|
Converts the value to the specified unit from a base unit. |
|
Gets the default accuracy of for the specified unit |
|
Gets the name of the unit by its code |
|
Returns all units with their names |
|
Add one measurement to another. |
|
Divides a measurement to a specified a constant. |
|
Calculate ratio between two measurements |
|
Checks whether two measurements are equal |
|
Explicitly converts the a tuple to a value |
|
Checks whether the measurement is greater than another |
|
Checks whether the measurement is greater than or equal to another |
|
Implicitly converts the value to a tuple |
|
Implicitly converts the value to an anonymous tuple |
|
Implicitly converts the value to a double value-based measurement |
|
Checks whether two measurements are not equal |
|
Checks whether the measurement is less than another |
|
Checks whether the measurement is less than or equal another |
|
Multiples a measurement by a constant. |
|
Multiples a measurement by a constant. |
|
Subtracts one measurement from another. |
|
Negates the measurement value |
|
Unary plus value |
|
Parses the unit name |
|
Converts the value from the specified units to a base unit. |
|
Try to parse the value using the current culture |
|
Try to parse the value using the specified culture |
Public Fields | |
The unit |
|
Numerical value |
Public Properties | |
The value as a string with maximum accuracy in invariant culture |
Public Constructors | |
Constructor that accepts numeric value and unit |
|
Constructor that accepts a tuple. |
|
Constructor that accepts a anonymous tuple. |
|
Constructor that accepts a text representation of a value |
Public Methods | |
Compares measurement to another measurement |
|
Checks whether the measurement equals to another measurement |
|
Checks whether the measurement equals to another measurement |
|
Returns hash code of the value |
|
Returns the value in the specified units |
|
Converts the value into another unit. |
|
Convert to string with maximum accuracy in invariant culture |
|
Convert to string with maximum accuracy in the specified culture |
|
Convert to string with specified format |