Gehtsoft.Measurements 1.1.13

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

// Install Gehtsoft.Measurements as a Cake Tool
#tool nuget:?package=Gehtsoft.Measurements&version=1.1.13                

About

The C# library to manipulate and convert with various measurements/units (e.g. distances, weight, angles, temperatures, and so on) expressed in various units (e.g. distances in inches, yards, meters).

The library may be useful for calculations, for example, in math, physic or GIS that does not depend from the system of units used (e.g. SI/Metric or Imperial) or to create a unit convertor application.

Currently, distance/length, velocity, weight, angular measurements, and energy units are supported.

The library is shared under LGPL license.

Using Library

The core class of the library is the generic structure Measurement. The structure accepts an enumeration as a parameter and this enumeration defines the measurement unit to be used:

 var v = new Measurement<DistanceUnit>(10, DistanceUnit.Feet);

You can then manipulate this value using C# operator, format them or convert it into another unit:

 var v1 = v * 2;
 string v = v.ToString("N3");
 var v2 = v1.To(DistanceUnit.Meter);

or

    var x = (10.As(DistanceUnit.Yard) + 36.As(DistanceUnit.Inch)).To(DistanceUnit.Meter);

The class fully supports serialization using System.Text.Json and Binaron.Serializer (see https://github.com/zachsaw/Binaron.Serializer). XmlSerializer cannot be implemented for a readonly structures without introducing of non-safe code. Please refer to tests for an example how to implement an XML serialization (https://github.com/gehtsoft-usa/Gehtsoft.Measurements/blob/76fc639a657186dc91615839ca9ded4c14af7bc2/Gehtsoft.Measurements.Test/CoreClassesTest.cs#L181).

Read more on http://docs.gehtsoftusa.com/Gehtsoft.Measurements/web-content.html#index.html

Defining your own units

You can define your own measurment units by creating a enumeration and mark it using Unit and Conversion attributes. The first attribute defines the unit name and the default accuracy of the values. The second attribute defines the rules of the conversion. One unit must always be a "base" unit, and conversion rules for other units defines how to convert the specified unit into a base unit.

enum MyWeightUnit
{
    //1 gram
    [Unit("g", 3)]
    [Conversion(ConversionOperation.Base)]
    Gram,

   //1 kilogram (1 kilogram = 1000 gram)
    [Unit("kg", 3)]
    [Conversion(ConversionOperation.Multiply, 1000)]
    Kilogram,
}
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 (1)

Showing the top 1 NuGet packages that depend on Gehtsoft.Measurements:

Package Downloads
BallisticCalculator

Ballistic Calculator

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.14 563 11/9/2022
1.1.13 1,473 7/29/2022
1.1.12 458 7/22/2022
1.1.11 523 3/23/2021
1.1.10 335 3/15/2021
1.0.9 356 1/25/2021

Add solid angle units.