Skip to content

Instantly share code, notes, and snippets.

@runceel
Created June 18, 2015 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runceel/6f3819504f247c762d0d to your computer and use it in GitHub Desktop.
Save runceel/6f3819504f247c762d0d to your computer and use it in GitHub Desktop.
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