C# .Net How to convert string to Guid?

This below is simple C# code for convert from String to GUID





public static Guid StringToGUID(string value)
        {
            MD5 md5Hasher = MD5.Create();
            byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(value));
            return new Guid(data);
        }
Reactions

Post a Comment

0 Comments