C# DriveInfo在当前上下文中不存在?
为什么在下面的C#LINQ代码中会出现以下错误C# DriveInfo在当前上下文中不存在?,c#,linq,driver,C#,Linq,Driver,为什么在下面的C#LINQ代码中会出现以下错误 DriveInfo在当前上下文中不存在 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { v
DriveInfo在当前上下文中不存在
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var drives = DriveInfo.GetDrives()
.Where(drive => drive.IsReady && drive.DriveType == DriveType.Removable);
}
}
}
非常感谢 您需要使用指令
:
using System.IO;
。。。进口