private void comPortWorker_DoWork(object sender, DoWorkEventArgs e) { List <cbxPortEntry> result = new List <cbxPortEntry>(); string[] comPorts = Ports.GetComPorts(); foreach (string port in comPorts) { int start = port.LastIndexOf('('); int end = port.LastIndexOf(')'); string designator = port.Substring(start + 1, end - start - 1).Trim(); if (!designator.EndsWith(":")) { designator += ":"; } string description = port.Substring(0, start - 1).Trim(); result.Add(new cbxPortEntry(designator, description)); } result.Sort(new AlphanumComparator()); e.Result = result; }