【发布时间】:2020-08-16 08:45:24
【问题描述】:
我有这个控制台应用程序:
namespace LinqTestFramework
{
using System.Collections.Generic;
public class Program
{
static void Main(string[] args)
{
var dict = new Dictionary<int, string>()
{
{ 1, "David" }
};
} //breakpoint set here: Watch window: System.Linq.Enumerable.Where(dict, x => true)
}
}
namespace LinqTestFramework
{
using System.Linq;
public class SomeClass
{
public void SomeMethod()
{
var valuesBelowFour = Enumerable.Range(0, 10).Where(x => x < 4);
}
}
}
我可以从 ILSpy 中看到包含这些方法的 System.Core dll:
我试图在调试期间从 Watch 窗口运行以下命令:
System.Linq.Enumerable.Where(dict, x => true)
但我收到此错误:
错误 CS0234:类型或命名空间名称“Linq”不存在于 命名空间“系统”(您是否缺少程序集引用?)
为什么我无法访问System.Linq.Enumerable 中的扩展方法?
【问题讨论】:
-
您使用的是什么 .net 版本?如果我是正确的,在 .net core 2.x 中有一个错误
-
@Jodn .NET Framework 4.7.2
标签: c# linq dll .net-4.7.2