Does not contain a definition for Where and no extension method?

c#, ienumerable, linq

Solution

`IAccountReader` does not implement `IEnumerable<Account>`.

Since you have provided a method `GetAccountFrom` you could also use this:

public IEnumerable<Account> GetAccountFrom(string file)
{
    return _accountReader.GetAccountFrom(file).Where(x => x.Age);
}

Apart from that the `Where` is incorrect, you need to provide a predicate, for example:

.Where(x => x.Age <= 10);

Problem

So I've looked around for awhile for the answer to my problem, and I'm seeing to add `using System.Linq`, except I already have that there so I don't know what my code isn't compiling. In my context of code, `_accountreader` exists, so why is it saying no definition of it exists? The line `return _accountReader.Where(x => x.Age);` is where the compiler yells at me. ``` public interface IAccountReader { IEnumerable<Account> GetAccountFrom(string file); } public class XmlFileAccountReader : IAccountReader { public IEnumerable<Account> GetAccountFrom(string file) { var accounts = new List<Account>(); //read accounts from XML file return accounts; } } public class AccountProcessor { private readonly IAccountReader _accountReader; public AccountProcessor(IAccountReader accountReader) { _accountReader = accountReader; } public IEnumerable<Account> GetAccountFrom(string file) { return _accountReader.Where(x => x.Age); } } public class Account { public int Age { get; set; } } ```

Original source