Last active
December 12, 2015 04:38
-
-
Save belsrc/4715782 to your computer and use it in GitHub Desktop.
Find duplicate items in multiple lists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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