blog.mha.dk
The on-line blog of Michael Holm Andersen

Creating GUIDs in C#

Thursday, 29 October 2009 11:40 by mha

While creating GUIDs today, I discovered that there is a few overloads to choose from in order to format the GUID:

System.Guid.NewGuid().ToString() = 93262f39-1842-4ec1-ad62-6cf115838450
System.Guid.NewGuid().ToString("N") = 7498c82cbb3c4c9dbdfef3cd2cc4bf9f
System.Guid.NewGuid().ToString("D") = 600d242a-2d7d-4957-a0a3-540e43b3cea8
System.Guid.NewGuid().ToString("B") = {521b19e3-f948-403f-8287-e71312bdacde}
System.Guid.NewGuid().ToString("P") = (310e1808-ed8d-4a09-add7-c214b4c530b6)

Categories:  
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed
Comments are closed