I need help in turning this linq expression into a linq statment. SampleData.Publishers and SampleData.Books are simple collections that I have from the Linq in Action book.
Here is the expression
var pubBooks =
from pub in SampleData.Publishers
join book in SampleData.Books on pub.Name equals book.Publisher.Name into pubbks
select new {
Publisher = pub.Name,
Books =
from b in pubbks
select b.Title
};
Here is what I have so far, but I can't seem to get the books collection defined in the anonymous type. Thanks for your time.
var pubBooks = SampleData.Publishers.Join(SampleData.Books, pub => pub.Name, book => book.Publisher.Name, (pub, book) => new {
Publisher=pub.Name,
Books=??????
});