bileyazan
bileyazan

Reputation: 352

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 difference?

Upvotes: 10

Views: 5033

Answers (5)

Brian Genisio
Brian Genisio

Reputation: 48147

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;

Upvotes: 6

Steve Mitcham
Steve Mitcham

Reputation: 5313

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.

Upvotes: 1

Sandeep Kumar M
Sandeep Kumar M

Reputation: 3851

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

System.Linq added in 3.5

Upvotes: 1

Will Dean
Will Dean

Reputation: 39520

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

Upvotes: 2

ScottE
ScottE

Reputation: 21630

Did you import System.Linq ?

Upvotes: 39

Related Questions