Here is an example that I took from here :
using System.IO.Ports;
private static void SendSampleData() {
SerialPort port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
communications port.Open();
port.Write("Hello World");
port.Write(new byte[] {0x0A, 0xE2, 0xFF}, 0, 3);
port.Close();
}
Write , W. 02 03 , \x, \x03;