Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"default": true,
"line-length": false,
"no-inline-html": false,
"no-bare-urls": false,
"no-emphasis-as-heading": false,
"code-block-style": {
"style": "fenced"
},
// Headers must start at the beginning of the line - false positive in some cases where it makes sense.
"MD023": false,
// First line in a file should be a top-level heading - false positive for include files.
"MD041": false,
// Link fragments should be valid - false positive for DocFx tabs
"MD051": false
}
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Contributing to Units.NET

Guidelines for contributing to the repo.

<!--markdownlint-disable MD026 -->
## We want your help and we are friendly to first-time contributors!

Adding a new unit or a new quantity is easy! We have detailed the steps here and if you need any assistance we are happy to help!

https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit
Expand All @@ -11,20 +12,24 @@ We also want the person with the idea, suggestion or bug report to implement the
This is to help grow the number of people that can contribute to the project and after someone new lands that first PR we often see more PRs from that person later.

## Coding Conventions

* Match the existing code style, we generally stick to "Visual Studio defaults" and [.NET Foundation Coding Guidelines](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md)
* If you use ReSharper there is a [settings file](https://github.com/angularsen/UnitsNet/blob/master/UnitsNet.sln.DotSettings) that will take effect automatically
* There is an [.editorconfig](https://github.com/angularsen/UnitsNet/blob/master/.editorconfig) to help configure whitespace and C# syntax for your editor if it supports it
* Add the file header to new files you create

### Test Code

* Test class: Use `Tests` suffix for the type you are testing, such as `UnitSystemTests`
* Test method: `<method>_<condition>_<result>` (`Parse_AmbiguousUnits_ThrowsException`)
* If there are many tests for a single method, you can wrap those in an inner class named the same as the method and then you can skip that part of the test method names

## Unit definitions (.JSON)

For a fairly complete summary of the unit definition JSON schema, see [Meter of Length](https://github.com/angularsen/UnitsNet/blob/master/Common/UnitDefinitions/Length.json). It has prefix units and multiple cultures.

### Conversion functions

Converting from unit A to B is achieved by first converting from unit A to the base unit, then from the base unit to unit B. To achieve this, each unit defines two conversion functions.

* Prefer multiplication for `FromUnitToBaseFunc` (`{x} * 2.54e-2` for `Inch` to `Meter`)
Expand All @@ -34,13 +39,15 @@ Converting from unit A to B is achieved by first converting from unit A to the b
* Prefer a calculation if the conversion factor is infinite (`({x} / 72.27)*2.54e-2` for `PrinterPoint`)

### Units

Generally we try to name the units as what is the most widely used.

* Use prefix for country variants, such as `ImperialGallon` and `UsGallon`

**Note:** We should really consider switching variant prefix to suffix, since that plays better with kilo, mega etc.. Currently we have units named `KilousGallon` and `KiloimperialGallon`, these would be better named `KilogallonUs` and `KilogallonImperial`.

### Unit abbreviations

A unit can have multiple abbreviations per culture/language, the first one is used by `ToString()` while all of them are used by `Parse()`.

* Prefer the most widely used abbreviation in the domain, but try to adapt to our conventions
Expand Down
29 changes: 17 additions & 12 deletions Docs/top-dependencies.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
| url | stars |
# Top Dependencies by GitHub Stars

The following table lists the top public repositories using Units.NET, along with their GitHub star counts (as of May 2025):

| Repo | Stars |
|-----------------------------------------------------------------|---------|
| https://github.com/microsoft/PowerToys | 93K |
| https://github.com/dotnet/iot | 2.0K |
| https://github.com/angularsen/UnitsNet | 1.9K |
| https://github.com/genielabs/HomeGenie | 367 |
| https://github.com/raspberry-sharp/raspberry-sharp-io | 337 |
| https://github.com/microsoft/PowerToys | 120K |
| https://github.com/dotnet/iot | 2.3K |
| https://github.com/genielabs/HomeGenie | 410 |
| https://github.com/raspberry-sharp/raspberry-sharp-io | 340 |
| https://github.com/nanoframework/nanoFramework.IoT.Device | 258 |
| https://github.com/porrey/Virtual-ZPL-Printer | 240 |
| https://github.com/chino-os/chino-os | 147 |
| https://github.com/BriefFiniteElementNet/BriefFiniteElement.Net | 128 |
| https://github.com/porrey/Virtual-ZPL-Printer | 95 |
| https://github.com/WhiteBlackGoose/UnitsOfMeasure | 56 |
| https://github.com/pi-top/pi-top-4-.NET-SDK | 47 |
found 451 repositories others repositories are private
found 154 repositories with more than zero star
| https://github.com/BriefFiniteElementNet/BriefFiniteElement.Net | 156 |
| https://github.com/WhiteBlackGoose/UnitsOfMeasure | 59 |
| https://github.com/pi-top/pi-top-4-.NET-SDK | 50 |

_Total repositories listed: 10_

_Star counts are based on the latest data in the main README and may change over time._
Loading