首页 > 其他 > 详细

C#串口通信->自动获取串口号

时间:2014-09-15 14:07:58      阅读:705      评论:0      收藏:0      [点我收藏+]

 

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.IO.Ports;
 6 
 7 namespace SerialPortExample1
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             // Get a list of serial port names.
14             string[] ports = SerialPort.GetPortNames();
15 
16             Console.WriteLine("The following serial ports were found:");
17 
18             // Display each port name to the console.
19             foreach (string port in ports)
20             {
21                 Console.WriteLine(port);
22             }
23 
24             Console.ReadLine();
25 
26         }
27     }
28 }

bubuko.com,布布扣

---恢复内容结束---

C#串口通信->自动获取串口号

原文:http://www.cnblogs.com/dingwei/p/3972605.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!