UnitTools 1.0.2
dotnet add package UnitTools --version 1.0.2
NuGet\Install-Package UnitTools -Version 1.0.2
<PackageReference Include="UnitTools" Version="1.0.2" />
<PackageVersion Include="UnitTools" Version="1.0.2" />
<PackageReference Include="UnitTools" />
paket add UnitTools --version 1.0.2
#r "nuget: UnitTools, 1.0.2"
#:package UnitTools@1.0.2
#addin nuget:?package=UnitTools&version=1.0.2
#tool nuget:?package=UnitTools&version=1.0.2
UnitTools
High-performance .NET unit conversions — straightforward numeric APIs, strongly typed quantities, and precise calculations.
GitHub repository · Documentation · Release notes
UnitTools includes 150 conversion families, 1,858 registered units, and 39,458 directed non-identity conversions within compatible families. Choose direct numeric conversion, fluent extensions, typed quantities, exact decimal/rational conversion, dynamic parsing, or custom unit definitions. The core library has no third-party runtime package dependencies.
Packages
| NuGet package | Purpose |
|---|---|
UnitTools |
Full conversion engine and quantity APIs |
UnitTools.SystemTextJson |
Optional System.Text.Json support for typed unit values |
UnitTools.Analyzers |
Optional Roslyn compile-time guidance |
All three packages ship with the same version, currently 1.0.2. Install only the parts you need.
Installation
dotnet add package UnitTools
For JSON integration or analyzer diagnostics, install the matching companion package in addition to the core package.
Quick start
using UnitTools;
using UnitTools.Length;
using UnitTools.Quantities;
// Numeric conversion: 4 km -> 4000 m.
double meters = UnitToolsLength.Convert(
4d,
UnitToolsLengthUnit.Kilometer,
UnitToolsLengthUnit.Meter);
// Fluent numeric conversion.
double fluentMeters = 4d.Convert(
UnitToolsLengthUnit.Kilometer,
UnitToolsLengthUnit.Meter);
// Keep the unit attached to a value.
double wrappedMeters = new UnitValue<UnitToolsLengthUnit>(
4d, UnitToolsLengthUnit.Kilometer)
.To(UnitToolsLengthUnit.Meter).Value;
// Compile-time dimensional safety.
Length<decimal> distance = Length<decimal>.FromKilometres(4m);
decimal typedMeters = distance.Metres;
Parsing, exact arithmetic, and composite units
double speed = UnitToolsDynamic.Convert("36 km/h", "m/s");
decimal exact = UnitToolsExact.Convert(
1m, UnitToolsLengthUnit.Inch, UnitToolsLengthUnit.Foot);
double energy = UnitToolsComposite.Convert(1d, "N*m", "J");
Compatibility and design
- Core: .NET Standard 2.0 and .NET 8.
- JSON and analyzer companions: .NET Standard 2.0.
- Standalone core without third-party runtime dependencies.
- Exact decimal/rational paths, span-based parsing/formatting, localization, composite units, and arbitrary-scale number naming.
- Release validation includes tests, API compatibility checks, NativeAOT smoke tests, and clean NuGet consumers.
Documentation and license
For complete APIs, sample programs, benchmarking, and supported families, visit the GitHub README.
License: Apache License 2.0 with Commons Clause v1.0. Redistribution is subject to the Commons Clause restriction on selling the software itself. Review the full license before redistribution.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on UnitTools:
| Package | Downloads |
|---|---|
|
UnitTools.SystemTextJson
System.Text.Json serialization companion for UnitTools typed unit values, with stable enum-name output, catalog alias input, and NativeAOT validation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2 | 133 | 10/13/2026 |
1.0.1: 150 conversion families and 1,858 unit entries; catalog-wide strongly typed quantities and dimensional arithmetic; exact decimal/rational conversion; allocation-free span parsing/formatting for typed quantities; optimized dynamic detection and composite expressions; runtime custom units; integrated arbitrary-scale number conversion; System.Text.Json companion support; NativeAOT validation; definition-driven culture-aware unit display/parse localization; culture-consistent typed/span parsing and named quantity formatting; completed inverse dimensional arithmetic; culture-symmetric dynamic detection; immutable/indexed runtime metadata; hardened exact and arbitrary-scale input contracts; XML IntelliSense docs; symmetric catalog lookups; tightened public result/TryConvert contracts; public API compatibility gate; catalog-wide mathematical conformance and parser abuse guards; expanded Dutch localization coverage; multi-TFM clean consumer verification; optional analyzer guidance package; Apache-2.0 with Commons Clause v1.0 licensing.