SerialPort.GetPortNames().Select(port =>
{
var portNumStr = port.Substring(3);
int portNumber = 0;
return new {
PortName = port,
PortNumber = int.TryParse(portNumStr, out portNumber)
? (int?)portNumber
: null
};
}).ToList().ForEach(pi => {
Console.WriteLine("Name: {0} \t Number: {1}", pi.PortName, pi.PortNumber);
});