// OrtizOL - xCSw - http://o...content-available-to-author-only...t.com
using System;
using System.IO.Ports;
namespace Receta.CSharp.R0520
{
public class UsoGetPortNames
{
public static void Main()
{
Console.WriteLine(Environment.NewLine);
// Obtiene la lista de los nombres de los puertos
// seriales del equipo local:
string[] puertos = SerialPort.GetPortNames();
Console.WriteLine("Puertos disponibles:");
foreach(string puerto in puertos)
{
Console.WriteLine("\t{0}", puerto);
}
Console.WriteLine(Environment.NewLine);
}
}
}
Ly8gT3J0aXpPTCAtIHhDU3cgLSBodHRwOi8vby4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4udC5jb20KIAp1c2luZyBTeXN0ZW07CnVzaW5nIFN5c3RlbS5JTy5Qb3J0czsKIApuYW1lc3BhY2UgUmVjZXRhLkNTaGFycC5SMDUyMAp7CiAgICBwdWJsaWMgY2xhc3MgVXNvR2V0UG9ydE5hbWVzCiAgICB7CiAgICAgICAgcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQogICAgICAgIHsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoRW52aXJvbm1lbnQuTmV3TGluZSk7CiAgICAgICAgICAgIAogICAgICAgICAgICAvLyBPYnRpZW5lIGxhIGxpc3RhIGRlIGxvcyBub21icmVzIGRlIGxvcyBwdWVydG9zIAogICAgICAgICAgICAvLyBzZXJpYWxlcyBkZWwgZXF1aXBvIGxvY2FsOgogICAgICAgICAgICBzdHJpbmdbXSBwdWVydG9zID0gU2VyaWFsUG9ydC5HZXRQb3J0TmFtZXMoKTsKICAgICAgICAgICAgCiAgICAgICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJQdWVydG9zIGRpc3BvbmlibGVzOiIpOwogICAgICAgICAgICBmb3JlYWNoKHN0cmluZyBwdWVydG8gaW4gcHVlcnRvcykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIlx0ezB9IiwgcHVlcnRvKTsKICAgICAgICAgICAgfQogICAgICAgICAgICAKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoRW52aXJvbm1lbnQuTmV3TGluZSk7CiAgICAgICAgfQogICAgfQp9