Unfortunately the names of these methods make terrible search terms, and I\'ve been unable to find a good resource that explains the difference between these methods--as in
context.Authors.Where(a => a.Books.Any(b => b.BookID == bookID)).ToList();
a.Books is the list of books by that author. The property is automatically created by Linq-to-Sql, provided you have a foreign-key relationship set up.
So, a.Books.Any(b => b.BookID == bookID) translates to "Do any of the books by this author have an ID of bookID", which makes the complete expression "Who are the authors of the book with id bookID?"
That could also be written something like
from a in context.Authors
join b in context.Books on a.AuthorId equal b.AuthorID
where b.BookID == bookID
select a;
UPDATE:
Any() as far as I know, only returns a bool. Its effective implementation is:
public Any(this IEnumerable coll, Func predicate)
{
foreach(T t in coll)
{
if (predicte(t))
return true;
}
return false;
}