Accepted answer

not linq syntax, but at least more elegant...

list<note> mergednotes =
    .groupby(x => x.userid)
    .selectmany(g => getmergednotesfor(g.orderby(x => x.createdon)))

with my test data it creates the same result as your original code.


i think this does the trick:

var mergednotes = new list<note>();
mergednotes.addrange((from n in notes
                      orderby n.createdon
                      group n by n.userid into g
                      let m = getmergednotesfor(g)
                      select m).selectmany(m => m));
return mergednotes;

Related Query

More Query from same tag