string result = ""; string filePath = "xxx.bin"; if (File.Exists(filePath)) { byte[] b = File.ReadAllBytes(filePath); foreach (byte bt in b) { result += Convert.ToString(bt, 16); } }