开发者

IList<T> does not have "where"

In a specific project at my work, I have a method that returns IList. But this interface does not contain where, or FindAll filters. However, when I open a new project, IList contains all. What is the 开发者_StackOverflow中文版difference?


Did you import System.Linq ?


Nope. IEnumerable<T> has "where" as an extension method.

Assuming your project is .Net 3.5 or greater, you need to have using System.Linq;


You might find this useful: LINQ, Where() vs FindAll()


Check .NET Framework of opened framework, may be its .NET Fx 2.

System.Linq added in 3.5


Here's a basic discussion of extension methods in general. As mentioned by others, the Where method is an extension method found in the System.Linq namespace so you need to import it in order to have intellisense detect the existence of those methods.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜