Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // OrtizOL - xCSw - http://ortizol.blogspot.com
  2.  
  3. using System;
  4. using System.IO.Ports;
  5.  
  6. namespace Receta.CSharp.R0520
  7. {
  8.     public class UsoGetPortNames
  9.     {
  10.         public static void Main()
  11.         {
  12.             Console.WriteLine(Environment.NewLine);
  13.            
  14.             // Obtiene la lista de los nombres de los puertos
  15.             // seriales del equipo local:
  16.             string[] puertos = SerialPort.GetPortNames();
  17.            
  18.             Console.WriteLine("Puertos disponibles:");
  19.             foreach(string puerto in puertos)
  20.             {
  21.                 Console.WriteLine("\t{0}", puerto);
  22.             }
  23.            
  24.             Console.WriteLine(Environment.NewLine);
  25.         }
  26.     }
  27. }