ktsu.Semantics.Quantities.Decimal
5.5.1
Prefix Reserved
dotnet add package ktsu.Semantics.Quantities.Decimal --version 5.5.1
NuGet\Install-Package ktsu.Semantics.Quantities.Decimal -Version 5.5.1
<PackageReference Include="ktsu.Semantics.Quantities.Decimal" Version="5.5.1" />
<PackageVersion Include="ktsu.Semantics.Quantities.Decimal" Version="5.5.1" />
<PackageReference Include="ktsu.Semantics.Quantities.Decimal" />
paket add ktsu.Semantics.Quantities.Decimal --version 5.5.1
#r "nuget: ktsu.Semantics.Quantities.Decimal, 5.5.1"
#:package ktsu.Semantics.Quantities.Decimal@5.5.1
#addin nuget:?package=ktsu.Semantics.Quantities.Decimal&version=5.5.1
#tool nuget:?package=ktsu.Semantics.Quantities.Decimal&version=5.5.1
ktsu.Semantics.Quantities.Decimal
Storage-type aliases that bind every
ktsu.Semantics.Quantitiestype todecimal, so you writeMassinstead ofMass<decimal>, project-wide.
ktsu.Semantics.Quantities.Decimal is a satellite of ktsu.Semantics.Quantities in the ktsu.Semantics family. Read the core package README first for the quantity API itself.
Introduction
Every quantity in ktsu.Semantics.Quantities is generic over its numeric storage type, so you normally write Mass<decimal>, Speed<decimal>, and so on. If a project uses one storage type throughout, that generic argument is noise.
This package is props-only. It ships no assembly, just a build props file that injects one C# global-using alias per quantity, binding each open generic type to decimal. Reference it and you can write Mass, Speed, Force3D with no generic argument, and every quantity resolves to its decimal form. The aliases are real Mass<decimal> (and so on), so they interoperate with the entire API with no conversion.
Installing this package also pulls in the matching version of ktsu.Semantics.Quantities as a dependency, so it is the only reference you need.
Installation
Package Manager Console
Install-Package ktsu.Semantics.Quantities.Decimal
.NET CLI
dotnet add package ktsu.Semantics.Quantities.Decimal
Package Reference
<PackageReference Include="ktsu.Semantics.Quantities.Decimal" Version="x.y.z" />
Usage Example
using ktsu.Semantics.Quantities; // types resolve to their decimal form via the injected aliases
Mass mass = Mass.FromKilogram(10.0m);
Speed speed = Speed.FromMeterPerSecond(15.0m);
Mass total = mass + Mass.FromKilogram(2.0m); // still a Mass<decimal>, full identity
Force3D f = new() { X = 3.0m, Y = 4.0m, Z = 0.0m };
ForceMagnitude mag = f.Magnitude(); // 5.0
Under the hood the injected alias looks like this (one line per quantity, roughly 220 in total):
<Using Include="ktsu.Semantics.Quantities.Mass<decimal>" Alias="Mass" />
Use exactly one storage-type alias package per project
The aliases are project-wide global usings keyed on the bare type name (Mass, Speed, ...). Referencing two flavor packages in the same project would define the same alias name twice (one bound to decimal, one to another type), which is a compile error. So reference exactly one of:
ktsu.Semantics.Quantities.Doublektsu.Semantics.Quantities.Floatktsu.Semantics.Quantities.Decimal(this package)ktsu.Semantics.Quantities.Precise
A project that genuinely needs mixed storage types should skip the alias packages and reference ktsu.Semantics.Quantities directly, writing the closed generic (Mass<decimal>) explicitly.
The binding applies to the project that declares the PackageReference, and to no other. The props
ship in the package's build/ folder rather than buildTransitive/, so they are not inherited by
projects that reference this project. An application assembled from several projects, each wrapping
a different storage type, therefore compiles: each project that wants aliases references its own alias
package, and no project collects a binding it never asked for. Earlier versions shipped the props in
buildTransitive/, where the binding did flow downstream and two of them in one dependency graph
produced a wall of CS1537 against a generated file the author never wrote; PrivateAssets="all" on
the alias reference was the workaround for that, and is no longer needed.
The alias lists are generated from the quantity catalogue by scripts/Generate-AliasProps.ps1 and validated in CI, so they stay in lockstep with the quantities the core package emits.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
License
This project is licensed under the MIT License. See the LICENSE.md file for details.
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- ktsu.Semantics.Quantities (>= 5.5.1)
-
net8.0
- ktsu.Semantics.Quantities (>= 5.5.1)
-
net9.0
- ktsu.Semantics.Quantities (>= 5.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.5.1 | 41 | 9/22/2026 |
| 5.5.0 | 39 | 9/22/2026 |
| 5.4.3 | 67 | 9/21/2026 |
| 5.4.2 | 70 | 9/18/2026 |
| 5.4.1 | 67 | 9/17/2026 |
| 5.4.0 | 58 | 9/17/2026 |
| 5.3.4 | 97 | 9/16/2026 |
| 5.3.3 | 70 | 9/16/2026 |
| 5.3.2 | 65 | 9/16/2026 |
| 5.3.1 | 119 | 9/15/2026 |
| 5.3.0 | 109 | 9/14/2026 |
| 5.2.4 | 105 | 9/14/2026 |
| 5.2.3 | 106 | 9/14/2026 |
| 5.2.2 | 99 | 9/14/2026 |
| 5.2.1 | 99 | 9/13/2026 |
| 5.2.0 | 109 | 9/13/2026 |
| 5.1.0 | 104 | 9/13/2026 |
| 5.0.1 | 108 | 9/13/2026 |
| 5.0.0 | 103 | 9/12/2026 |
| 4.3.2 | 99 | 9/12/2026 |
## v5.5.1 (patch)
Changes since v5.5.0:
- Keep a path's equality and hash code stable when a derived property is read [patch] ([@Claude](https://github.com/Claude))