Convert Guid To Guid Binary String : Guid « Development Class « C# / C Sharp






Convert Guid To Guid Binary String

 

using System;
using System.Security.Principal;
using System.Text;

static class ConvertUtility
{

    public static string ConvertGuidToGuidBinaryString(Guid guid)
    {
        byte[] guidBytes = guid.ToByteArray();
        StringBuilder guidBinary = new StringBuilder();
        foreach (byte guidByte in guidBytes)
        {
            guidBinary.AppendFormat(@"\{0}", guidByte.ToString("x2"));
        }
        return guidBinary.ToString();
    }
}      

   
  








Related examples in the same category

1.Create Guid
2.Converts the string representation of a Guid toits Guid equivalent.
3.This code example demonstrates the Guid.NewGuid() method.
4.Parse GUID
5.Is valid GUID
6.Use Regular expression to check the Guid