为什么我在下面的C# LINQ代码中得到以下错误
DriveInfo does not exist in current context?
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);
}
}
}首先要感谢大家!
发布于 2012-08-14 21:12:58
您需要一个using指令:
using System.IO;..。导入System.IO.DriveInfo。
https://stackoverflow.com/questions/11953014
复制相似问题