SharpMeasures 0.3.70

dotnet add package SharpMeasures --version 0.3.70
                    
NuGet\Install-Package SharpMeasures -Version 0.3.70
                    
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="SharpMeasures" Version="0.3.70" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpMeasures" Version="0.3.70" />
                    
Directory.Packages.props
<PackageReference Include="SharpMeasures" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpMeasures --version 0.3.70
                    
#r "nuget: SharpMeasures, 0.3.70"
                    
#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.
#:package SharpMeasures@0.3.70
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpMeasures&version=0.3.70
                    
Install as a Cake Addin
#tool nuget:?package=SharpMeasures&version=0.3.70
                    
Install as a Cake Tool

SharpMeasures

SharpMeasures is an easily extended C# library that aims to encourage explicit usage of physical quantities and units of measurement during development. This is done by providing concrete types, such as Time, UnitOfLength, and Acceleration3 - together with a custom-built source generator. While SharpMeasures is mainly designed as a treatment for primitive obsession, common matematical operations are also implemented, allowing quantities to be derived from other quantities - as demonstrated below.

Displacement3 displacement = (0, 1.5, -4) * Distance.OneMetre;
Time time = 0.5 * Time.OneSecond;

Velocity3 velocity = displacement / time;

Console.WriteLine(velocity); // "(0, 3, -8) [m∙s⁻¹]"
Console.WriteLine(velocity.KilometresPerHour); // ~ "(0, 10.8, -28.8)"

See GitHub for more information.

Source Generator

The source generator used to implement SharpMeasures allows you to easily extend the existing set of quantities, or make new units and quantities from scratch:

using SharpMeasures.Generators;

[SpecializedScalarQuantity(typeof(Height))]
public partial class Altitude { }

This source generator can be found here.

Extensions

Soem additional, more situational, units and quantities can be found here:

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

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SharpMeasures:

Package Downloads
SharpMeasures.Astronomy

Extends SharpMeasures with astronomy-related quantities.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.70 5,683 1/4/2023
0.3.69 464 12/14/2022
0.3.68 455 12/6/2022
0.3.67 475 11/9/2022
0.3.66 645 10/24/2022
0.3.63 521 10/22/2022
0.3.62 631 10/22/2022
0.3.60 541 10/21/2022
0.3.59 511 10/18/2022
0.2.2.34 514 9/8/2022