c# list contains duplicates code example
Example 1: c# find duplicates in list of strings
var list = new List<string>();
list.GroupBy(n => n).Any(c => c.Count() > 1);
Example 2: c# see if list contains any duplicates
var list = new List<string>();
// Fill the list
if(list.Count != list.Distinct().Count())
{
// Duplicates exist
}