A GUID of by any other name?

I was mokeying around today with GUID's and had a time with the durn things returning '00000000-0000-0000-0000-000000000000' as the GUID value.

The code I was using was;

[code:c#]Guid g = new Guid();[/code]

Then that would create a new Guid and set its value to '00000000-0000-0000-0000-000000000000'. Blah.

So instead I find this;

[code:c#]Guid g = Guid.NewGuid();[/code]

This generates a proper Guid value (was '1b6d4d3c-0e6e-4967-a389-281c4fb435d3' in this case).

Geez. You figure that would do what you want, someone smarter than I am about Guid's can leave a comment to clear up the mystery.

Enjoy!

 

Leave a Reply