Cysharp / Ulid

Fast .NET C# Implementation of ULID for .NET and Unity.
MIT License
1.29k stars 58 forks source link

Unable to create new Ulid from Guid #63

Closed Channwar closed 1 week ago

Channwar commented 8 months ago

Hi,

here's my code : Guid id = new Guid("018ced5c-1f3d-da5f-8349-8acba12a5e3f"); Ulid idUlid = new Ulid(id);

And here's the result : image

The Ulid.Guid is incorrect.

I don't really understand why and how to fix this, thank you for your time.

Sincerely,

Nicolas

Funkest commented 7 months ago
Guid id = new Guid("018ced5c-1f3d-da5f-8349-8acba12a5e3f");
Ulid idUlid = new Ulid(id);
if ((Guid)idUlid == id && idUlid.ToGuid() == id)
{
    Console.WriteLine("works");
}
else throw new Exception();

This code always outputs "works" and never throws, works as expected. While you mentioned "The Ulid.Guid is incorrect," I believe you should provide further details if there's any issue; Ulid type doesn't have Guid named property

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.