Your Books
class must implement IEnumerable<Book>
, not just IEnumerable
. The Where
extension, as most of LINQ extensions, are made for objects implementing IEnumerable<T>
. This interface is located in the System.Collections.Generic
namespace.
Right now you could use the Cast()
extension:
var list3 = bookList.Cast<Book>().Where(n => n.author.Length >= 14);
This is something you can do with legacy collections that only implements IEnumerable
. However, in your scenario, the Books
class is yours so I really would recommend that you make it implement IEnumerable<Book>
.