Convert byte[] or object to GUID

前端 未结 5 2303
一个人的身影
一个人的身影 2021-02-12 10:27

I assigned some value to object data type like,

object objData =dc.GetDirectoryEntry().Properties[\"objectGUID\"].Value;

this object retun the

5条回答
  •  醉话见心
    2021-02-12 11:11

    The long form would be (enter link description here):

    public static string ConvertGuidToOctectString(string objectGuid)
    {
        System.Guid guid = new Guid(objectGuid);
        byte[] byteGuid = guid.ToByteArray();
        string queryGuid = "";
        foreach (byte b in byteGuid)
        {
            queryGuid += @"\" + b.ToString("x2");
        }
        return queryGuid;
    }
    

提交回复
热议问题