Siret.Net 1.0.0

dotnet add package Siret.Net --version 1.0.0
                    
NuGet\Install-Package Siret.Net -Version 1.0.0
                    
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="Siret.Net" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Siret.Net" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Siret.Net" />
                    
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 Siret.Net --version 1.0.0
                    
#r "nuget: Siret.Net, 1.0.0"
                    
#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 Siret.Net@1.0.0
                    
#: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=Siret.Net&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Siret.Net&version=1.0.0
                    
Install as a Cake Tool

Siret.Net

Zero-dependency validation of French business identifiers for .NET: the SIREN (9-digit legal-entity id) and the SIRET (14-digit establishment id), plus the SIREN / NIC relationship between them.

NuGet   MIT   Zero dependencies   Native AOT clean

Why

Existing .NET options are either an online API wrapper (a network call to check a checksum) or a large multi-country monolith. Doing it by hand usually gets one case wrong: La Poste. Its SIRETs do not satisfy the Luhn checksum yet are valid, so a plain Luhn check wrongly rejects them.

Install

dotnet add package Siret.Net

Use

using Siret;

bool ok = SiretNumber.IsValid("732 829 320 00074");      // true, spaces/dots/hyphens ignored

SiretNumber siret = SiretNumber.Parse("73282932000074");  // throws FormatException when invalid
string siren = siret.Siren.Value;                         // "732829320"
string nic   = siret.Nic;                                 // "00074"
string text  = siret.Format();                            // "732 829 320 00074"

if (SirenNumber.TryParse("404833048", out var entity)) { /* entity.Value */ }

Both SirenNumber and SiretNumber offer IsValid, throwing Validate / Parse, and non-throwing TryValidate / TryParse. null makes the Try methods return false; the throwing ones raise ArgumentNullException for null and FormatException for anything else invalid.

Rules

  • SIREN: 9 digits, Luhn checksum.
  • SIRET: 14 digits. The whole number is checked, and its first 9 digits must themselves be a valid SIREN.
  • La Poste exception: a SIRET starting with 356000000 (other than the head office 35600000000048) is valid when the sum of its digits is divisible by 5, instead of Luhn. The head office still uses Luhn. The La Poste SIREN 356000000 itself satisfies Luhn.
  • Separators (space, dot, hyphen) are ignored. Any other non-digit, or a wrong length, is invalid.

Credit

A port of the fr.siren and fr.siret modules of python-stdnum by Arthur de Jong and contributors (LGPL-2.1+). This library is an independent reimplementation of the documented rules and is MIT licensed.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.
  • net8.0

    • No dependencies.

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.0.0 149 10/10/2026