private string ByteArrayToHexString(byte[] data)
{
StringBuilder sb = new StringBuilder(data.Length * 3);
for(int i = 0; i < data.Length; i++)
{
sb.Append(Convert.ToString(data[i], 16).PadLeft(2, '0'));
}
return sb.ToString().ToUpper();
}
Or just:
string hex = BitConverter.ToString(data);