Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DriveInfo在当前上下文中不存在?_C#_Linq_Driver - Fatal编程技术网

C# DriveInfo在当前上下文中不存在?

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

为什么在下面的C#LINQ代码中会出现以下错误

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;
。。。进口