【发布时间】:2013-06-05 08:41:29
【问题描述】:
我有以下构造,我不能使用 Where 子句作为 linq 查询的一部分,我想知道为什么:
public abstract class Foo : IFoo
{
public Foo(List<int> testCollection)
{
var result = testCollection.Where(.......).Select(.....);
}
}
Intellisense 无法识别 Where 子句,我也收到编译错误。这与我试图在抽象类中使用它有关吗?我使用 .Net 4.5,我可以在常规类中构造 Linq 查询。
【问题讨论】:
-
文件顶部有
using System.Linq指令吗?没有其他明显的原因无法识别它...... -
@Trustme-I'maDoctor,愚蠢的我。您当然是对的,尽管奇怪的是,VS 都没有建议缺少使用引用,也没有 Telerik 的 JustCode。谢谢
标签: c# linq list dictionary where