So I have this:
IEnumerable<IGrouping<UInt64, MyObject>> groupedObjects = myObjectsResults.GroupBy(x => x.Id);
The question is, how do I turn this result into an IEnumerable<List<MyObject>>
?
This is as far as I could take it:
IEnumerable<List<MyObject>> groupedObjects = (myObjectsResults.GroupBy(x => x.Id).SelectMany(group => group).ToList());
which is obviously incorrect. Any ideas?
IEnumerable<List<MyObject>> groupedObjects = myObjectsResults.GroupBy(x => x.Id)
.Select(group => group.ToList())
.ToList();