RSS Feed for This PostCurrent Article

C#: Retrieving and Sorting COM Ports

In .NET, it is easy to retrieve all existing COM ports and sort them accordingly

string[] portNames = SerialPort.GetPortNames();
var sortedList = portNames.OrderBy(port => Convert.ToInt32(port.Replace("COM", string.Empty)));
foreach (string port in sortedList)

Trackback URL

Sorry, comments for this entry are closed at this time.