Aoxe.UUIDv7 2025.1.4
Aoxe.UUIDv7
Aoxe.UUIDv7 is a C# library for generating UUID version 7 identifiers based on the proposed RFC. It provides time-ordered UUIDs with improved sorting and uniqueness features.
1. Features
- Generate version 7 UUIDs.
- Convert UUIDs to shorter string representations.
- Optimized Base32 encoding.
- Includes unit tests using xUnit.
2. Installation
Install via NuGet Package Manager:
dotnet add package Aoxe.UUIDv7
Or via the Package Manager Console:
Install-Package Aoxe.UUIDv7
3. Usage
using Aoxe.UUIDv7;
class Program
{
static void Main()
{
// Generate a UUIDv7
Guid uuid = Uuid7Generator.GenerateUuid7();
// Convert to a 25-character Base32 string
string id25 = uuid.ToId25();
// Convert to a 22-character Base64URL string
string id22 = uuid.ToId22();
Console.WriteLine($"UUIDv7: {uuid}");
Console.WriteLine($"ID25: {id25}");
Console.WriteLine($"ID22: {id22}");
}
}
4. API Reference
4.1. Uuid7Generator.GenerateUuid7()
Generates a new UUID version 7.
4.2. Uuid7Generator.ToId25(this Guid uuid)
Converts a UUID to a 25-character Base32 encoded string.
4.3. Uuid7Generator.ToId22(this Guid uuid)
Converts a UUID to a 22-character Base64URL encoded string.
5. Contributing
Contributions are welcome. Please submit issues and pull requests for any improvements.
6. License
This project is licensed under the MIT License.
No packages depend on Aoxe.UUIDv7.
.NET 8.0
- No dependencies.
.NET 9.0
- No dependencies.
.NET Standard 2.0
- No dependencies.