It looks like you want ToLookup:
var lookup = MyObjects.ToLookup(x => x.ID);
This allows you to get all values for any particular identifier or iterate over groups. He eagerly appreciated, not the GroupBylazy assessment, which you probably want in this case.
Assuming I understood your request correctly - it’s possible that I didn’t do this ... it would be helpful if you could clarify.
source
share