An array of serial port names for the current computer.
The order of port names returned from SerialPort.GetPortNames is not specified.
Use the SerialPort.GetPortNames method to query the current computer for a list of valid serial port names. For example, you can use this method to determine whether COM1 and COM2 are valid serial ports for the current computer.
The port names are obtained from the system registry (for example, HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM). If the registry contains stale or otherwise incorrect data then the SerialPort.GetPortNames method will return incorrect data.