my query :
public List<Book> GetAllBook()
{
return (from c in this.LDEntities.Book
select new
{
c.IdBook,
c.NameBook,
c.Athour
}).ToList();
}
error :
Cannot implicitly convert type ‘AnonymousType#1’ to ‘System.Collections.Generic.List
What is the correct code?
Update: I use from Entity Framework in Layered Architectures.
Try this:
In other words, create a collection of type Book, not a collection of anonymous types.