Quantify.Length makes it easy to work with lengths, when multiple different units are involved.
var lengthInKilometers = Length.Create(11.2, Unit.Kilometre);
var lengthInMiles = Length.Create(5, Unit.Mile);
var totalLengthInKilometers = lengthInKilometers + lengthInMiles;
For more information about the Quantify framework and what features are available, please see Quantify.
Quantify.Length contains two different class for working with lengths.
Length stores the quantity values as a double
. This means that class is optimized towards performace instead of precision. As a result of this round-off errors might occur.
PreciseLength stores the quantity value as a decimal
, which is optimized towards precision instead of performance. The consequence of this is a slight performance hit when doing calculations, but round-off errors are avoided.
The following units are supported in the latest version. The units can also be found in Unit.
SI | Imperial | Typographic (Planned) | Astronomical (Planned) |
---|---|---|---|
|
|
© Copyright 2020 Michel Gammelgaard. All rights reserved. Provided under the MIT license. Ruler icon by Michel Gammelgaard. © Copyright 2020 Michel Gammelgaard. All rights reserved.