how to check duplicate value in list c# 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# find duplicates in list
var query = lst.GroupBy(x => x)
.Where(g => g.Count() > 1)
.Select(y => y.Key)
.ToList();