tags:

views:

157

answers:

1

I am testing some db layer functions. In one, I am similating the user passing in the id (a GUID). I have hardcoded the guid for testign purposes but can't seem to assign it to a variable , as rediculous as that sounds. In C# for a .NET 2.0 app. I have tried several ways, all failed. What is the proper way to set a guid to a variable. Here is the code...

Guid x = "5fb7097c-335c-4d07-b4fd-000004e2d28c";
+5  A: 
Guid x = new Guid("5fb7097c-335c-4d07-b4fd-000004e2d28c");
blu
Guid Constructor: http://msdn.microsoft.com/en-us/library/96ff78dc%28VS.85%29.aspx
Jonathan Sampson
If you are wanting a random GUID, you can just code `Guid guid = System.Guid.NewGuid();`, and an empty one: `Guid guid = System.Guid.Empty;`
Anders