public static class Program
public static void Main()
string s = "7C04048404048C04049404059C0405";
var bufferByte = new byte[] { 0x40, 0x03, 0xE8, 0x03, 0xE8, 0x49 };
bufferByte = bufferByte.Concat(StringToByteArray(s)).ToArray();
Console.WriteLine(ByteArrayToString(bufferByte));
public static string ByteArrayToString(byte[] ba)
return BitConverter.ToString(ba).Replace("-", "");
public static byte[] StringToByteArray(string hex)
int numberChars = hex.Length;
byte[] bytes = new byte[numberChars / 2];
for (int i = 0; i < numberChars; i += 2)
bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);