Advertisement
Fhernd

UsoGetPortNames.cs

Jul 20th, 2015
1,568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement