Skip to content

Commit cc0a490

Browse files
author
Andreas Gullberg Larsen
authored
Update README.md
1 parent 4685474 commit cc0a490

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

README.md

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
[![Build status](https://ci.appveyor.com/api/projects/status/f8qfnqd7enkc6o4k?svg=true)](https://ci.appveyor.com/project/angularsen/unitsnet) [![Join the chat at https://gitter.im/UnitsNet/Lobby](https://badges.gitter.im/UnitsNet/Lobby.svg)](https://gitter.im/UnitsNet/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
22
[![Flattr this git repo](https://button.flattr.com/flattr-badge-large.png)](https://flattr.com/submit/auto?fid=g37dpx&url=https://github.com/angularsen/UnitsNet/&title=Units.NET&language=en-US&tags=github&category=software)
33

4-
Units.NET
5-
===
64

7-
Everyone have written their share of trivial conversions - or less obvious ones where you need to Google that magic constant.
5+
## Units.NET
86

9-
Stop littering your code with unnecessary calculations. Units.NET gives you all the common units of measurement and the conversions between them. It is light-weight, well-tested and portable.
7+
Everyone have written their share of trivial conversions - or less obvious ones where you need to Google that magic constant.
108

9+
Stop littering your code with unnecessary calculations, Units.NET gives you all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested.
1110

12-
Installing
13-
---
14-
Run the following command in the [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console) or go to the [NuGet site](https://www.nuget.org/packages/UnitsNet/) for the complete relase history.
1511

16-
![Install-Package UnitsNet](https://raw.githubusercontent.com/angularsen/UnitsNet/master/Docs/Images/install_package_unitsnet.png "Install-Package UnitsNet")
12+
### Build Targets
1713

18-
Build Targets:
1914
* .NET Standard 1.0
2015
* .NET 3.5 Client
2116
* [Windows Runtime Component](https://docs.microsoft.com/en-us/windows/uwp/winrt-components/) for UWP apps (JavaScript, C++ or C#)
2217

23-
Overview
24-
---
18+
19+
### Overview
20+
2521
* [48 quantities with a total of 500+ units](UnitsNet/GeneratedCode/Enums) generated from [JSON](UnitsNet/UnitDefinitions/) by [Powershell scripts](UnitsNet/Scripts)
2622
* [1000+ unit tests](https://ci.appveyor.com/project/angularsen/unitsnet) on conversions and localizations
2723
* Immutable structs that implement `Equatable`, `IComparable`
@@ -37,8 +33,16 @@ Overview
3733
* [Continuous integration](#ci) posts status reports to pull requests and commits
3834
* [Who are using this?](#who-are-using)
3935

40-
<a name="static-typing"></a>Static Typing
41-
---
36+
37+
### Installing
38+
39+
Run the following command in the [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console) or go to the [NuGet site](https://www.nuget.org/packages/UnitsNet/) for the complete relase history.
40+
41+
![Install-Package UnitsNet](https://raw.githubusercontent.com/angularsen/UnitsNet/master/Docs/Images/install_package_unitsnet.png "Install-Package UnitsNet")
42+
43+
44+
### <a name="static-typing"></a>Static Typing
45+
4246
```C#
4347
// Convert to the unit of choice - when you need it
4448
Mass weight = GetPersonWeight();
@@ -55,8 +59,8 @@ double feet = meter.Feet; // 3.28084
5559
double inches = meter.Inches; // 39.3701
5660
```
5761

58-
<a name="operator-overloads"></a>Operator Overloads
59-
---
62+
### <a name="operator-overloads"></a>Operator Overloads
63+
6064
```C#
6165
// Arithmetic
6266
Length l1 = 2 * Length.FromMeters(1);
@@ -70,8 +74,8 @@ Acceleration a2 = Force.FromNewtons(100) / Mass.FromKilograms(20);
7074
RotationalSpeed r = Angle.FromDegrees(90) / TimeSpan.FromSeconds(2);
7175
```
7276

73-
<a name="extension-methods"></a>Extension Methods
74-
---
77+
### <a name="extension-methods"></a>Extension Methods
78+
7579
All units have associated extension methods for a really compact, expressive way to construct values or do arithmetic.
7680
```C#
7781
using UnitsNet.Extensions.NumberToDuration;
@@ -85,8 +89,8 @@ Acceleration stdGravity = 9.80665.MeterPerSecondSquared();
8589
Force weight = 80.Kilograms() * stdGravity; // 80 kilograms-force or 784.532 newtons
8690
```
8791

88-
<a name="culture"></a>Culture and Localization
89-
---
92+
### <a name="culture"></a>Culture and Localization
93+
9094
The culture for abbreviations defaults to Thread.CurrentUICulture and falls back to US English if not defined. Thread.CurrentCulture affects number formatting unless a custom culture is specified. The relevant methods are:
9195

9296
* ToString()
@@ -117,8 +121,8 @@ RotationalSpeedUnit rpm2 == RotationalSpeed.ParseUnit("r/min"); // RotationalSp
117121
string abbrevKg = Mass.GetAbbreviation(MassUnit.Kilogram); // "kg"
118122
```
119123

120-
<a name="example-app"></a>Example: Creating a unit converter app
121-
---
124+
### <a name="example-app"></a>Example: Creating a unit converter app
125+
122126
*TODO: Add actual sample app and link to it here with screenshot. See [#274](https://github.com/angularsen/UnitsNet/issues/274) for details.*
123127

124128
This example shows how you can create a dynamic unit converter, where the user selects the quantity to convert, such as `Length` or `Mass`, then selects to convert from `Meter` to `Centimeter` and types in a value for how many meters.
@@ -135,8 +139,8 @@ double centimeters = UnitConverter.ConvertByName(5, "Length", "Meter", "Centimet
135139
double centimeters2 = UnitConverter.ConvertByAbbreviation(5, "Length", "m", "cm"); // 500
136140
```
137141

138-
<a name="precision"></a>Precision and Accuracy
139-
---
142+
### <a name="precision"></a>Precision and Accuracy
143+
140144
A base unit is chosen for each unit class, represented by a double value (64-bit), and all conversions go via this unit. This means there will always be a small error in both representing other units than the base unit as well as converting between units.
141145

142146
Units.NET was intended for convenience and ease of use, not highly accurate conversions, but I am open to suggestions for improvements.
@@ -146,8 +150,8 @@ The tests accept an error up to 1E-5 for most units added so far. Exceptions inc
146150
For more details, see [Precision](https://github.com/angularsen/UnitsNet/wiki/Precision).
147151

148152

149-
<a name="serialization"></a>Serialization
150-
---
153+
### <a name="serialization"></a>Serialization
154+
151155
* `UnitsNet.Serialization.JsonNet` ([nuget](https://www.nuget.org/packages/UnitsNet.Serialization.JsonNet), [src](https://github.com/angularsen/UnitsNet/tree/master/UnitsNet.Serialization.JsonNet), [tests](https://github.com/angularsen/UnitsNet/tree/master/UnitsNet.Serialization.JsonNet.Tests)) for JSON.NET
152156

153157
**Important!**
@@ -156,8 +160,8 @@ We cannot guarantee backwards compatibility, although we will strive to do that
156160
The base unit of any unit should be be treated as volatile as we have changed this several times in the history of this library already. Either to reduce precision errors of common units or to simplify code generation. An example is Mass, where the base unit was first Kilogram as this is the SI unit of mass, but in order to use powershell scripts to generate milligrams, nanograms etc. it was easier to choose Gram as the base unit of Mass.
157161

158162

159-
<a name="contribute"></a>Want To Contribute?
160-
---
163+
### <a name="contribute"></a>Want To Contribute?
164+
161165
This project is still early and many units and conversions are not yet covered. If you are missing something, please help by contributing or [ask for it](https://github.com/angularsen/UnitsNet/issues) by creating an issue.
162166

163167
Please read the wiki on [Adding a New Unit](https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit).
@@ -168,15 +172,15 @@ Generally adding a unit involves adding or modifying `UnitsNet\UnitDefinitions\*
168172
* Do work on branches such as **feature/add-myunit** and **fix/34**
169173
* [Create a pull request](https://help.github.com/articles/using-pull-requests)
170174

171-
<a name="ci"></a>Continuous Integration
172-
---
175+
### <a name="ci"></a>Continuous Integration
176+
173177
[AppVeyor](https://ci.appveyor.com/project/angularsen/unitsnet) performs the following:
174178
* Build and test all branches
175179
* Build and test pull requests, notifies on success or error
176180
* Deploy nugets on master branch, if nuspec versions changed
177181

178-
<a name="who-are-using"></a>Who are Using This?
179-
---
182+
### <a name="who-are-using"></a>Who are Using This?
183+
180184
It would be awesome to know who are using this library. If you would like your project listed here, [create an issue](https://github.com/angularsen/UnitsNet/issues) or edit the [README.md](https://github.com/angularsen/UnitsNet/edit/master/README.md) and send a pull request. Max logo size is `300x35 pixels` and should be in `.png`, `.gif` or `.jpg` formats.
181185

182186
![Motion Catalyst logo](http://swingcatalyst.s3.amazonaws.com/images/logos/MotionCatalyst_greenblack_35p.png "Motion Catalyst logo")

0 commit comments

Comments
 (0)