这句linq如何写成lambda表达式


这句linq怎么写成lambda表达式?

  C# code

   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() };



.net 程序开发 linq

糸色望小生 11 years, 1 month ago


可以用如下方式

  C# code

  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 = aunt() });

永遠なる旋律 answered 11 years, 1 month ago

Your Answer