Created
June 18, 2015 02:33
-
-
Save runceel/6f3819504f247c762d0d to your computer and use it in GitHub Desktop.
This file contains 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
using System; | |
using System.Linq; | |
namespace ConsoleApplication5 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var l = new[] | |
{ | |
"aaa", | |
"bbb", | |
"ccc", | |
"ddd", | |
"eee", | |
"fff", | |
"aaa", | |
"aaa", | |
"ddd", | |
}; | |
var dups = l.GroupBy(x => x) | |
.Where(x => x.Count() >= 2) | |
.Select(x => x.Key) | |
.ToList(); | |
foreach (var item in dups) | |
{ | |
Console.WriteLine(item); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment