Posted By

kwhite1975 on 04/10/13


distinct lambda BY group Express

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Lambda Expression To Select a distinct set of objects

 / Published in: C#


This line of code allows you to group a set of objects by a field and then get the first item in that group. This allows you to do a distinct by a specific property.

  1. myObject.GroupBy(c => c.Id).Select(grp => grp.First());

Report this snippet  

You need to login to post a comment.