Ulid icon indicating copy to clipboard operation
Ulid copied to clipboard

Unable to create new Ulid from Guid

Open Channwar opened this issue 1 year ago • 1 comments

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

Channwar avatar Jan 10 '24 13:01 Channwar

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

Funkest avatar Feb 06 '24 11:02 Funkest

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.

github-actions[bot] avatar Aug 05 '24 00:08 github-actions[bot]