RedStar.Amounts.StandardUnits 4.2.0

dotnet add package RedStar.Amounts.StandardUnits --version 4.2.0
NuGet\Install-Package RedStar.Amounts.StandardUnits -Version 4.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RedStar.Amounts.StandardUnits" Version="4.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RedStar.Amounts.StandardUnits --version 4.2.0
#r "nuget: RedStar.Amounts.StandardUnits, 4.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RedStar.Amounts.StandardUnits as a Cake Addin
#addin nuget:?package=RedStar.Amounts.StandardUnits&version=4.2.0

// Install RedStar.Amounts.StandardUnits as a Cake Tool
#tool nuget:?package=RedStar.Amounts.StandardUnits&version=4.2.0


Build status

This project may seem dormant, but it is mainly due to having reach a stable point. It is still actively being maintained and is safe to use in production applications. If you encounter any issues or need extra features, don't hesitate to create an issue.

RedStar.Amounts contains classes to easily work with unit and amounts.

Too often, applications use integers, doubles, etc. to indicate distances, weights, and other measured values. This can cause problems because assumptions are made on the units, conversions have to be done, etc.

This can cause hard-to-trace bugs and leads to less readable code.

Say you have a public service (WCF, REST, ...) that takes in measurements from an external service. Which of the following do you prefer?

public class SomeService
    public void ReportMeasurement(double length, double height)
        // external system sends values in meters, but we work with cm
        var lengthInCm = length * 100;
        var heightInCm = height * 100;
        var area = lengthInCm * heightInCm;

Or this:

public class SomeService
    public void ReportMeasurement(Amount length, Amount height)
        var area = length * height;

In the second example, the area variable will automatically have a value and a unit. The unit will be m².

This makes it easier and more fail-proof to do calculations later.


RedStar.Amounts consists of three Nuget packages:

Packages are released according to semantic versioning and all latest versions should work together without any problems.


You can find the latest documentation here.

.NET versions

This library targets .NET Standard 2.0.

Source, license

This code was taken and built upon from CodeProject. Credit is due to Rudi Breedenraedt. The code is licensed under the CPOL.

Product 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 was computed.  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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
4.2.0 128 1/10/2024
4.1.5 436 10/17/2022
4.1.4 367 10/17/2022
4.1.3 363 10/17/2022
4.1.2 681 11/6/2019
4.1.1 560 7/10/2019
4.1.0 754 10/5/2018
4.0.0 729 9/11/2018
3.0.1 880 6/26/2018
2.0.0 992 11/6/2017
1.5.0 1,300 5/23/2016