{"id":23088125,"url":"https://github.com/ultimaweapon/netulid","last_synced_at":"2025-08-16T07:31:26.915Z","repository":{"id":41981941,"uuid":"359323749","full_name":"ultimicro/netulid","owner":"ultimicro","description":"High quality/performance ULID implementation for .NET","archived":false,"fork":false,"pushed_at":"2024-01-17T15:44:36.000Z","size":64,"stargazers_count":17,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-11T05:37:06.650Z","etag":null,"topics":["csharp","distributed-systems","dotnet","ulid"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ultimicro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-19T04:03:56.000Z","updated_at":"2024-09-12T08:33:17.000Z","dependencies_parsed_at":"2022-08-12T01:20:28.095Z","dependency_job_id":null,"html_url":"https://github.com/ultimicro/netulid","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimicro%2Fnetulid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimicro%2Fnetulid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimicro%2Fnetulid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimicro%2Fnetulid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ultimicro","download_url":"https://codeload.github.com/ultimicro/netulid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230019763,"owners_count":18160600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","distributed-systems","dotnet","ulid"],"created_at":"2024-12-16T20:16:02.994Z","updated_at":"2025-08-16T07:31:21.634Z","avatar_url":"https://github.com/ultimicro.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetUlid\n\nThis is a dependency-free, high quality and high performance [ULID](https://github.com/ulid/spec) implementation for .NET. It is 100% conformance to the\nspecifications. This library has been used extensively on [Cloudsumé](https://cloudsume.com) so it is production ready.\n\n| Package                        | Version                                                                                                                                   |\n| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| NetUlid                        | [![Nuget](https://img.shields.io/nuget/v/NetUlid)](https://www.nuget.org/packages/NetUlid/)                                               |\n| NetUlid.Tool                   | [![Nuget](https://img.shields.io/nuget/v/NetUlid.Tool)](https://www.nuget.org/packages/NetUlid.Tool)                                      |\n\n## Benchmark\n\nThe following is a result of benchmark against [Ulid](https://github.com/Cysharp/Ulid) and [NUlid](https://github.com/RobThree/NUlid):\n\n```ini\nBenchmarkDotNet=v0.13.1, OS=arch\nAMD Ryzen 7 PRO 4750U with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores\n.NET SDK=6.0.102\n  [Host]     : .NET 6.0.2 (6.0.222.11801), X64 RyuJIT\n  DefaultJob : .NET 6.0.2 (6.0.222.11801), X64 RyuJIT\n```\n\n|                                Type |           Method |        Mean |     Error |    StdDev |  Gen 0 | Allocated |\n|------------------------------------ |----------------- |------------:|----------:|----------:|-------:|----------:|\n|                      ParseCanonical |          NetUlid |  33.5171 ns | 0.2185 ns | 0.2044 ns |      - |         - |\n|                      ParseCanonical |             Ulid |  24.1547 ns | 0.0795 ns | 0.0744 ns |      - |         - |\n|                      ParseCanonical |            NUlid | 138.4496 ns | 0.1844 ns | 0.1725 ns | 0.0019 |     168 B |\n|                            ToString |          NetUlid |  29.6122 ns | 0.1598 ns | 0.1495 ns | 0.0010 |      80 B |\n|                            ToString |             Ulid |  35.0151 ns | 0.3129 ns | 0.2927 ns | 0.0010 |      80 B |\n|                            ToString |            NUlid |  99.5217 ns | 0.1938 ns | 0.1718 ns | 0.0043 |     360 B |\n|                              Equals |          NetUlid |   3.7180 ns | 0.0023 ns | 0.0019 ns |      - |         - |\n|                              Equals |             Ulid |   0.9967 ns | 0.0123 ns | 0.0115 ns |      - |         - |\n|                              Equals |            NUlid |  30.2570 ns | 0.0865 ns | 0.0810 ns | 0.0010 |      80 B |\n|                           CompareTo |          NetUlid |   3.1449 ns | 0.0059 ns | 0.0055 ns |      - |         - |\n|                           CompareTo |             Ulid |   4.3326 ns | 0.0313 ns | 0.0293 ns |      - |         - |\n|                           CompareTo |            NUlid |  16.3404 ns | 0.0404 ns | 0.0378 ns | 0.0005 |      40 B |\n|                             GetTime | NetUlidTimestamp |   5.6709 ns | 0.0040 ns | 0.0038 ns |      - |         - |\n|                             GetTime |          NetUlid |   7.5541 ns | 0.0293 ns | 0.0274 ns |      - |         - |\n|                             GetTime |             Ulid |  29.6340 ns | 0.0055 ns | 0.0052 ns |      - |         - |\n|                             GetTime |            NUlid |  38.6922 ns | 0.1105 ns | 0.1034 ns | 0.0007 |      64 B |\n|                 ConstructFromBinary |          NetUlid |   4.8743 ns | 0.0331 ns | 0.0277 ns |      - |         - |\n|                 ConstructFromBinary |             Ulid |   2.2938 ns | 0.0037 ns | 0.0034 ns |      - |         - |\n|                 ConstructFromBinary |            NUlid |   8.5336 ns | 0.0006 ns | 0.0005 ns |      - |         - |\n| ConstructFromTimestampAndRandomness |          NetUlid |  10.4408 ns | 0.2397 ns | 0.2243 ns |      - |         - |\n| ConstructFromTimestampAndRandomness |             Ulid |   8.3920 ns | 0.0023 ns | 0.0019 ns |      - |         - |\n\nThe reasons for no ULID generating benchmark is because both `Ulid` and `NUlid` fail to conforming to the specifications when timestamp is the same as\npreviously generated.\n\n## When to use ULID\n\nYou should use ULID if you plan to migrate your data to the distributed database in the future and your data requires\nsorting. What sorting mean not only display sorting but also including data paging. If your data don't need sorting\nability you should stick with `Guid`. Keep in mind that ULID will expose data creation time automatically to anyone who\ncan access it.\n\n## Different from GUID\n\nThe main difference with `Guid` is ULID is sortable, which will make it shine on distributed system. You can think it is\na data type to replace auto-increment in SQL, but for distributed database like Cassandra.\n\n## Different from UUID version 1\n\nUUID version 1 (AKA timestamp UUID) require a special logic on the database in order to sort it correctly while ULID is\nnot.\n\n## Different from Twitter Snowflake\n\nULID and Twitter Snowflake is very similar. In term of functionalities Twitter Snowflake is better due to it can embed\nadditional data. So if you need to embed additional data to the value you should use Twitter Snowflake instead.\n\n## Usage\n\n### Generate a new ULID with current time\n\n```csharp\nusing NetUlid;\n\nvar ulid = Ulid.Generate();\n```\n\n### Create a ULID with specified timestamp and randomness\n\n```csharp\nusing NetUlid;\n\nvar ulid = new Ulid(timestamp, randomness);\n```\n\n### Create a ULID from binary representation\n\n```csharp\nusing NetUlid;\n\nvar ulid = new Ulid(binary);\n```\n\n### Compare two ULIDs\n\n```csharp\nif (ulid1 \u003e ulid2)\n{\n    // Do something.\n}\nelse if (ulid1 \u003c ulid2)\n{\n    // Do something.\n}\nelse if (ulid1 == ulid2)\n{\n    // Do something.\n}\n```\n\n### Get a raw binary representation\n\n```csharp\nvar binary = ulid.ToByteArray();\n```\n\n### Get canonical representation\n\n```csharp\nvar canonical = ulid.ToString();\n```\n\n### Create a ULID from canonical representation\n\n```csharp\nusing NetUlid;\n\nvar ulid = Ulid.Parse(canonical);\n```\n\n## Integration with other libraries\n\n### ASP.NET Core\n\nThe `Ulid` structure can be using as argument on the action (e.g. query string, route parameter, etc.) without any additional works. The input will be accepted\nas canonical form.\n\n### System.Text.Json\n\nThe `Ulid` structure has `JsonConverterAttribute` applied so that mean it can be using with `System.Text.Json` without any additional works.\n\n## CLI Tool\n\nWe also provide [.NET Tool](https://www.nuget.org/packages/NetUlid.Tool) for ULID related tasks. Follow the guide how to\nuse .NET Tool [here](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools) for the instructions how to\ninstall and use it.\n\n## The Ulid structure\n\nThe struct itself is in a binary form. What is mean is it can be interop with unmanaged code directly.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultimaweapon%2Fnetulid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultimaweapon%2Fnetulid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultimaweapon%2Fnetulid/lists"}