Code to find the duplicate record in C#

Amatya
Posted by Amatya under C# category on | Points: 40 | Views : 1829
 var UserList = new ArrayList { "Amatya", "Aditya", "Amatya", "Sanjay", "Ram", "Sanjay", "Mahadev" };
var RepeatVal =
(from string item in UserList select item).GroupBy(s => s).Select(
group => new { Word = group.Key, Count = group.Count() }).Where(x => x.Count >= 2);

foreach (var result in RepeatVal)
{
ddlList.Items.Add(result.Word);
}


The duplicate values will be added into dropdownlist

Thanks
Amatya

Comments or Responses

Login to post response