Matt
Matt

Reputation: 7254

Why I cannot use the Linq Where clause in a method of a public abstract class?

I have the following construct and I cannot use the Where clause as part of a linq query and I wonder why:

public abstract class Foo : IFoo
{
    public Foo(List<int> testCollection)
    {
        var result = testCollection.Where(.......).Select(.....);

    }
}

Intellisense does not recognize the Where clause and I also get a compile error. Is that related to me trying to use it within an abstract class? I use .Net 4.5 and I can construct Linq queries in regular classes.

Upvotes: 2

Views: 2003

Answers (1)

Rawling
Rawling

Reputation: 50114

Have you got using System.Linq; at the top of the C# file? :)

Upvotes: 10

Related Questions