Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidbreyer/9762497 to your computer and use it in GitHub Desktop.
Save davidbreyer/9762497 to your computer and use it in GitHub Desktop.
Select distinct items from a List using LINQ
var distinctMessages = messages.GroupBy(x => x.Text).Select(group => group.First()).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment