Convert String To GUID

Convert String To GUID

Here is conversion of string into GUID

Note*:1. Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). 
         
          2. Dashes should not be in wrong position for GUID parsing. 

e.g. this string is valid GUID "12345678-1234-1452-1234-123456781245"
 

string s = "c3120b72-5a57-4cde-9dd3-693edd6df697";

Guid g = (System.Guid)System.Data.SqlTypes.SqlGuid.Parse(s);

  Using MS SQL SERVER you can get the new guid like this


Select NEWID() 

Let me know what else you are trying ?

Satalaj

Tags:

C# DateTime ToString()Linq Convert String Array To Int ArrayC# Convert String To DateTime.net String vs stringConvert String To GUIDConvert Array To Comma Separated String C#Replace string in C#C# Binary To StringAsp.net Convert Image To Base64DateTime format Time String[C#] Remove Last Character From String

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.