日期:2014-05-20 浏览次数:20726 次
var cb = from p1 in b join p2 in bm on p1.BookId equals p2.BookId into bms from p2 in bms.DefaultIfEmpty() select new { p1.BookTitle, BookMessageContent=p2==null?"Nothing":p2.BookMessageContent,count=bms.count() };
var cb = b.GroupJoin(bm,p1=>p1.BookId,p2=>p2.BookId,(p1,p2)=>new {p1,p2}).Select(a=>new {a1=>a1.p1.BookTitle, BookMessageContent = a1.p2==null?"Nothing":a.p2.First().BookMessageContent,count = a1.p2.count() });