See Also: SerialPort Members
Use this class to control a serial port file resource. This class provides synchronous and event-driven I/O, access to pin and break states, and access to serial driver properties. Additionally, the functionality of this class can be wrapped in an internal System.IO.Stream object, accessible through the SerialPort.BaseStream property, and passed to classes that wrap or use streams.
The System.IO.Ports.SerialPort class supports the following encodings: System.Text.ASCIIEncoding, System.Text.UTF8Encoding, System.Text.UnicodeEncoding, System.Text.UTF32Encoding, and any encoding defined in mscorlib.dll where the code page is less than 50000 or the code page is 54936. You can use alternate encodings, but you must use the SerialPort.ReadByte or SerialPort.Write(Byte, int, int) method and perform the encoding yourself.
You use the SerialPort.GetPortNames method to retrieve the valid ports for the current computer.