ToString() formatting of Guid.NewGuid()


Console.WriteLine(Guid.NewGuid().ToString("n"));

e2fa63581f7642af83321e592e443f20


Console.WriteLine(Guid.NewGuid().ToString("d"));

a307cc65-413e-4d07-ab95-349ce6c313f6


Console.WriteLine(Guid.NewGuid().ToString("p"));

(e27f9b1f-f335-49e6-9ef8-ff7fdfccda3a)


Console.WriteLine(Guid.NewGuid().ToString("b"));

{8786c68f-cf57-4ea2-a956-8c48fc681da6}


Console.WriteLine(Guid.NewGuid().ToString("x"));

{0x6d0df007,0x5e83,0x4293,{0xb3,0x28,0xf1,0x6a,0xa8,0x5b,0xa6,0x61}}

Leave a Reply

Your email address will not be published. Required fields are marked *