错误无法找到源类型“System.Collections.Generic.List”的查询模式的实现。 '哪里'找不到。 [英] Error Could not find an implementation of the query pattern for source type 'System.Collections.Generic.List'. 'Where' not found.

查看:849
本文介绍了错误无法找到源类型“System.Collections.Generic.List”的查询模式的实现。 '哪里'找不到。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我写了这个例子:

Hi everyone
i wrote this example:

List<int> lstIndexes = new List<int>();
IEnumerable<int> resault =(from index in lstIndexes where index == newIndex select index);



但它有错误:


but it has error:

Could not find an implementation of the query pattern for source type 'System.Collections.Generic.List<int>'.  'Where' not found.



我的问题在哪里?

谢谢。


Where is my problem?
Thank you.

推荐答案

您需要1)添加对程序集System.Core的引用(默认情况下添加到从Visual Studio中的模板创建的新项目中),2)使用命名空间 System。 Linq

http:// msdn .microsoft.com / zh-cn / library / system.linq.aspx [ ^ ]。



-SA
You need to 1) add a reference to the assembly "System.Core" (added to a new project created from a template in Visual Studio by default), 2) use the namespace System.Linq:
http://msdn.microsoft.com/en-us/library/system.linq.aspx[^].

—SA


由于LINQ是.NET 3.0的功能,你应该通过选择版本3.0创建一个项目

请检查你是否选择了小于3.0

如果你想要了解哪个版本或者您想要更改.NET版本



1.右键单击您的项目并转到项目属性(最后一个选项)



2.在t他的应用程序选项卡看看目标框架是否为3.0如果小于3.0请将其更改为大于3.0



3.关闭当前选项卡并添加系统。 Linq命名空间并开始处理LINQ:)



谢谢。
Since LINQ is the feature of .NET 3.0 you should create a project by selecting the version 3.0
Please check if you have selected less than 3.0
If you want to know which version or if you want to change the .NET version

1.Right click on your project and Go to project properties(Last Option)

2. On the application Tab see if the "Target framework is 3.0" if its less than 3.0 please change it to greater than 3.0

3. Close the current tab and add System.Linq namespace and start working on "LINQ" :)

Thank you.


这应该有帮助

无法找到源类型查询模式的实现 - YouTube [ ^ ]


这篇关于错误无法找到源类型“System.Collections.Generic.List”的查询模式的实现。 '哪里'找不到。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆