System.Environment.PortNumber
using System; using System.IO.Ports; namespace SerialPortExample { class SerialPortExample { public static void Main() { string[] ports = SerialPort.GetPortNames(); foreach(string port in ports) { Console.WriteLine(port); } Console.ReadLine(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)