Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 21, 2015 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/4344a54c9d849f260a09 to your computer and use it in GitHub Desktop.
Save Fhernd/4344a54c9d849f260a09 to your computer and use it in GitHub Desktop.
Uso del método static SerialPort.GetPortNames para obtener los nombres de los puertos seriales del equipo local.
// OrtizOL - xCSw - http://ortizol.blogspot.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);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment