Skip to content

Instantly share code, notes, and snippets.

@belsrc
Last active December 12, 2015 04:38
Show Gist options
  • Save belsrc/4715782 to your computer and use it in GitHub Desktop.
Save belsrc/4715782 to your computer and use it in GitHub Desktop.
Find duplicate items in multiple lists
List<List<string>> lists = new List<List<string>>() {
new List<string> {"Hello", "World", "7"},
new List<string> {"Hello", "7", "Person"},
new List<string> {"7", "7", "Hello"}
};
List<string> common = lists.Cast<IEnumerable<string>>(
.Aggregate( ( a, b ) => a.Intersect( b ) )
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment