简体   繁体   中英

Linq to Lambda Expression c#

var ListInOrder = (from f in finaldatelist
               group f by new { f.RoomID, f.RateGroupID } into g
               select g);

What are the lambda expression for the into g and select g part?

This is what I got now:

 var ListInOrder = finaldatelist.GroupBy(x => x.RoomID, x => x.RateGroupID).Select();
finaldatelist.GroupBy(x => new { x.RoomID, x.RateGroupID });

It should be something like,

var ListInOrder  = finaldatelist.GroupBy(cm => new { cm.RoomID, cm.RateGroupID}, 
             (key, group) => new { RoomID= key.RoomID, RateGroupID = 
              key.RateGroupID});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM