5

Possible Duplicate:
Why is the GUID structure declared the way it is?

i've been looking a GUID generation and handling and is wondering why Microsoft has decided these "strange" formats.

A single format specifier that indicates how to format the value of this Guid. The format parameter can be "N", "D", "B", "P", or "X". If format is null or an empty string (""), "D" is used.

Say what?

Format flags goes as following:

N: 32 digits = 00000000000000000000000000000000

D: 32 digits separated by hyphens = 00000000-0000-0000-0000-000000000000

B: 32 digits separated by hyphens, enclosed in braces = {00000000-0000-0000-0000-000000000000}

P: 32 digits separated by hyphens, enclosed in parentheses = (00000000-0000-0000-0000-000000000000)

X: Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces = {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}

Why???

Why not a 00000000-00000000-00000000-00000000

or 0000-0000-0000-0000-0000-0000-0000-0000 ??

Does any one have a good answer, except its Microsoft? :o)

Community
  • 1
  • 1
BerggreenDK
  • 4,915
  • 9
  • 39
  • 61
  • "It's Microsoft" isn't even a good answer because GUID is just Microsoft's implementation of the UUID standard (Universally unique identifier), which defines the same format. http://en.wikipedia.org/wiki/Universally_Unique_Identifier – Matt Jul 06 '11 at 14:46
  • Apologies, twitchy "close" finger, not a duplicate of that question. – Binary Worrier Jul 06 '11 at 14:48
  • As a random aside, I had not previously known that guid actually had associated format strings. Does this mean that `Guid.Parse` or other similar tool can take in the format string in reverse with the guid instead of manually inserting hyphens etc into a string before converting it? | Also wish I could vote to not close so best i can do is +1 it. – Chris Marisic Jul 06 '11 at 14:56
  • Have a look here: http://stackoverflow.com/questions/276524/why-is-the-guid-structure-declared-the-way-it-is – Emond Jul 06 '11 at 15:05
  • Thanks all, it didnt really answer my initial question: whats up with the different formats, but @loan provided me with the link that explained it to me. Thanks for the effort though. – BerggreenDK Jul 17 '11 at 19:44
  • Wondering, since this question is still marked at duplicate and people states that it isn't - how do we get that sign removed again? do I have to edit the question ? – BerggreenDK Jul 15 '15 at 14:09

1 Answers1

5

UUID/GUID have standard representations according to RFC-4122. Simpler explanation here.

Community
  • 1
  • 1
Ioan
  • 2,382
  • 18
  • 32