65.9K
CodeProject is changing. Read more.
Home

Diff two lists

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

Dec 21, 2010

CPOL
viewsIcon

5415

I also updated the one easy way to remove duplicate element from two liststatic List removeDuplicates(List la){ Dictionary uniqueStore = new Dictionary(); List finalList = new List(); foreach (string currValue in...

I also updated the one easy way to remove duplicate element from two list
static List<string> removeDuplicates(List<string> la)
{
    Dictionary<string, int> uniqueStore = new Dictionary<string, int>();
    List<string> finalList = new List<string>();
    foreach (string currValue in la)
    {
        if (!uniqueStore.ContainsKey(currValue))
        {
            uniqueStore.Add(currValue, 0);
            finalList.Add(currValue);
        }
    }
    return finalList;
}