Answers for "check for duplicates in list c#"

C#
1

c# find duplicates in list of strings

var list = new List<string>();
list.GroupBy(n => n).Any(c => c.Count() > 1);
Posted by: Guest on June-08-2020
2

c# find duplicates in list

var query = lst.GroupBy(x => x)
              .Where(g => g.Count() > 1)
              .Select(y => y.Key)
              .ToList();
Posted by: Guest on June-08-2020
0

c# see if list contains any duplicates

var list = new List<string>();

// Fill the list

if(list.Count != list.Distinct().Count())
{
     // Duplicates exist
}
Posted by: Guest on May-17-2020

Code answers related to "check for duplicates in list c#"

C# Answers by Framework

Browse Popular Code Answers by Language