RedStar.Amounts 4.2.0

dotnet add package RedStar.Amounts --version 4.2.0
NuGet\Install-Package RedStar.Amounts -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" 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 --version 4.2.0
#r "nuget: RedStar.Amounts, 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 as a Cake Addin
#addin nuget:?package=RedStar.Amounts&version=4.2.0

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

RedStar.Amounts

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.

Installation

RedStar.Amounts consists of three Nuget packages:

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

Documentation

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.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on RedStar.Amounts:

Package Downloads
RedStar.Amounts.StandardUnits

Standard units to use with the RedStar.Amounts package. These contain units that are part of the International System of Units (or SI, from the French Système Internationale).

RedStar.Amounts.JsonNet

Custom converters for serializing and deseriazling RedStar.Amounts types to JSON using NewtonSoft's JSON.NET library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.2.0 173 1/10/2024
4.1.5 874 10/17/2022
4.1.4 769 10/17/2022
4.1.3 782 10/17/2022
4.1.2 1,060 11/6/2019
4.1.1 938 7/10/2019
4.1.0 1,274 10/5/2018
4.0.0 927 9/11/2018
2.1.1 1,138 2/21/2018
2.0.0 1,517 11/6/2017
1.5.0 1,632 5/23/2016