iSukces.UnitedValues 1.0.21294.27

There is a newer version of this package available.
See the version list below for details.
dotnet add package iSukces.UnitedValues --version 1.0.21294.27                
NuGet\Install-Package iSukces.UnitedValues -Version 1.0.21294.27                
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="iSukces.UnitedValues" Version="1.0.21294.27" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add iSukces.UnitedValues --version 1.0.21294.27                
#r "nuget: iSukces.UnitedValues, 1.0.21294.27"                
#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 iSukces.UnitedValues as a Cake Addin
#addin nuget:?package=iSukces.UnitedValues&version=1.0.21294.27

// Install iSukces.UnitedValues as a Cake Tool
#tool nuget:?package=iSukces.UnitedValues&version=1.0.21294.27                

United Values

In simple words it helps to calculate values that have attached units like length, area or density.

Performing calculations with decimals or double types we can (and in fact we really do) a lot of mistakes like below

Adding or substracting values with incompatible units

Original code

decimal lengthInMm = 10;
decimal lengthInMeters = 10;
Console.WriteLine(lengthInMm + lengthInMeters); // WRONG RESULT 20

Can be transformed into

Length lengthInMm = new Length(10, LengthUnits.Mm);
Length lengthInMeters = new Length(10, LengthUnits.Meter);           
Console.WriteLine(lengthInMm + lengthInMeters); // PROPER RESULT 10010,00 mm
Console.WriteLine(lengthInMeters + lengthInMm); // PROPER RESULT 10,01 m

While adding or subtracting values with different units result has always unit derived from first argument.

Passing arguments with different units into methods

static bool IsLongerThan2Meters(decimal length)
{
    // silently expects length in meters
    return length > 2;
}
...
decimal lengthInMm = 10;
decimal lengthInMeters = 10;
Console.WriteLine(lengthInMm); // WRONG USE
Console.WriteLine(lengthInMm);

Can be transformed into

static bool IsLongerThan2Meters(Length length)
{
    return length > new Length(2, LengthUnits.Meter);
}
...
Length lengthInMm = new Length(10, LengthUnits.Mm);
Length lengthInMeters = new Length(10, LengthUnits.Meter);
Console.WriteLine(IsLongerThan2Meters(lengthInMeters)); // TRUE
Console.WriteLine(IsLongerThan2Meters(lengthInMm)); // FALSE

Sample values

// kiloWatt
var power        = Power.FromKiloWatt(123);
var theSamePower = new Power(123, PowerUnits.KiloWatt);
// Temperature
var tempC = CelsiusTemperature.FromDegree(23);
var tempK = KelvinTemperature.FromDegree(300);
// length
var meters    = Length.FromMeter(10);
var miliMeter = Length.FromMilimeters(45);
// density kg/m³
var density = new Density(23, MassUnits.Kg, VolumeUnits.CubicMeter);
// stream [m³/s] [m³/h]
var stream1 = new VolumeStream(34, VolumeUnits.CubicMeter, TimeUnits.Second);
var stream2 = new VolumeStream(34, VolumeUnits.CubicMeter, TimeUnits.Hour);
// [J/kg*K] is supported
// [kJ/kg*C] is not supported
var specificHeatCapacityUnit = new SpecificHeatCapacityUnit(
    EnergyUnits.Joule,
    MassUnits.Kg,
    KelvinTemperatureUnits.Degree);
var waterSpecificHeatCapacity = new SpecificHeatCapacity(4211, specificHeatCapacityUnit);```
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 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  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
1.24.1018.34 115 10/18/2024
1.23.1218.33 259 12/18/2023
1.0.22324.31 386 11/20/2022
1.0.21325.30 741 11/21/2021
1.0.21311.29 359 11/7/2021
1.0.21309.28 330 11/5/2021
1.0.21294.27 342 10/21/2021
1.0.21289.26 398 10/16/2021
1.0.21247.25 357 9/4/2021
1.0.21241.24 339 8/29/2021
1.0.21217.23 334 8/5/2021
1.0.21197.22 365 7/16/2021
1.0.21193.21 359 7/12/2021
1.0.21191.20 442 7/10/2021
1.0.21158.19 394 6/7/2021
1.0.21093.18 356 4/3/2021
1.0.21086.17 409 3/27/2021