我有以下代码,但仍然必须键入完整路径才能使用 System.IO.Ports 命名空间,即使我有 using 子句。我的参考列表中是否缺少某些内容?
= new SerialPort 返回错误 5 'SerialPort' 是一个“命名空间”,但用作“类型”
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
namespace SerialPort
{
public partial class Form1 : Form
{
System.IO.Ports.SerialPort counter = new SerialPort("COM5");
public Form1()
{
InitializeComponent();
}
谢谢