OdoID 1.0.2
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
dotnet add package OdoID --version 1.0.2
NuGet\Install-Package OdoID -Version 1.0.2
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="OdoID" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OdoID" Version="1.0.2" />
<PackageReference Include="OdoID" />
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 OdoID --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OdoID, 1.0.2"
#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 OdoID@1.0.2
#: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=OdoID&version=1.0.2
#tool nuget:?package=OdoID&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OdoID
Deterministic mixed-radix ID encoding. Maps a ulong to a 6, 7, or 8-character alphanumeric string with a serial-number aesthetic.
OdoId.Encode(0, 6) → "0A0000"
OdoId.Encode(1234567, 6) → "0D7NM7"
OdoId.Encode(1234567, 7) → "0A15NM7"
OdoId.Encode(236223201279, 8) → "ZZ9ZZZZZ"
Features
- Deterministic — same integer + length always produces the same string, and vice-versa.
- Human-readable — ambiguous characters
I,L,Oare excluded from all positions. - Fixed positional structure — position 1 is always a letter, position 2 is always a digit.
- Zero dependencies — pure .NET standard library only.
- Multi-target —
net8.0,net6.0,netstandard2.1.
Install
dotnet add package OdoID
Usage
Encode
using OdoID;
OdoId.Encode(0, 6); // "0A0000"
OdoId.Encode(1234567, 6); // "0D7NM7"
OdoId.Encode(1234567, 7); // "0A15NM7"
OdoId.Encode(236223201279, 8); // "ZZ9ZZZZZ"
Default length is 6:
OdoId.Encode(0); // "0A0000"
Decode
OdoId.Decode("0A0000"); // 0UL
OdoId.Decode("0D7NM7"); // 1234567UL
Returns ulong. Input is uppercased before lookup, so "0d7nm7" is valid.
OdoIDGenerator
var g = new OdoIDGenerator(new GeneratorConfig
{
Namespace = "orders",
Length = 7
});
var result = g.Next();
// result.Id → e.g. "3H5NV2K"
// result.N → the raw ulong
// result.Length → 7
// result.Namespace → "orders"
Lengths and Capacity
| Length | Max integer (exclusive) |
|---|---|
| 6 | 230,686,720 |
| 7 | 7,381,975,040 |
| 8 | 236,223,201,280 |
Exceptions
| Exception | When |
|---|---|
OdoOverflowException |
n >= Max[length] |
UnsupportedLengthException |
length is not 6, 7, or 8 |
InvalidCharacterException |
character not in positional charset during decode |
All are subclasses of ArgumentOutOfRangeException or ArgumentException.
Run tests
dotnet test
Specification
See SPEC.md for the full processing instruction document.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | 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.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
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.
Initial release.