tags:

views:

489

answers:

5

Why are there dashes in a .NET GUID? Are there dashes in most implementations of a GUID, or is it just a Microsoft thing?

Signed,

741ecf77-9c92-4435-8e6b-85975bd13452

+6  A: 

It's just a convenience.

http://en.wikipedia.org/wiki/GUID

Otávio Décio
+3  A: 

This is an example of chunking, just like phone numbers, credit card numbers, etc.

Here is a good Wikipedia article about it.

Andrew Hare
+2  A: 

Just about every visual represenation of a guid that I've seen uses the dashed format. It's much easier on the eyes.

Chris Lively
+16  A: 

Technically, there are no "dashes" in a GUID. A GUID is a 128-bit value which is usually stored in the following manner (using C# here to represent the structure):

public struct Guid
{
  public ulong Data1;
  public ushort Data2;
  public ushort Data3;
  public fixed byte Data4[8];
}

The dashes are in the string representation of a GUID, usually placed at the points that would delimit the structure according to the above representation in memory.

The dashes are optional and are not required in a string representation of a GUID.

casperOne
+1  A: 

The Guid class of .Net recognizes a bunch of different formats: dashes as separators, no separators, brackets as delimiters, parenthesis as delimiters, no delimiters, etc

t3mujin