Posts tagged Bytes array to Hexadecimal string
Bytes array to Hexadecimal string
Feb 26th
1: public static string BytesToHex(byte[] bytes) 2: { 3: string hex = BitConverter.ToString(bytes); 4: return hex.Replace("-",""); 5: } 1: public static string BytesToHex(byte[] bytes) 2: { 3: StringBuilder hexString = new StringBuilder(bytes.Length); 4: for (int i = 0; i < bytes.Length; i++) 5: { 6: hexString.Append(bytes[i].ToString("X2")); 7: } 8: return hexString.ToString(); 9: }