Skip to content

Instantly share code, notes, and snippets.

View idea-lei's full-sized avatar

Lei idea-lei

View GitHub Profile
@idea-lei
idea-lei / ShortId.cs
Last active February 18, 2025 10:27
High performance Short Id
/// <summary>
/// High Performance and thread-safe ShortId in string format, preferred when a GUID is overkill.
/// </summary>
/// <remarks>
/// Based on long type (64 bit), so max length is 13, not recommanded for fewer than 6 chars. (6-13, 8 as default)
/// </remarks>
public static class ShortId
{
/// <summary>
/// 32 chars (2^5) removed some chars for better readablity