Click here to Skip to main content
15,118,865 members
Articles / Programming Languages / C#
Alternative
Tip/Trick
Posted 21 Dec 2010

Tagged as

Stats

4.8K views
1 bookmarked

Diff two lists

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
21 Dec 2010CPOL
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

XML
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;
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

maq_rohit
Technical Lead
United States United States
Rohit started Embedded Programing in his college days and now he is a Software Developer by Profession. Mainly he interested in cutting edge technology offer by Microsoft (i.e Azure,MVC). He Loves coding and his passion is always been towards Microsoft Technologies. Apart from coding his other hobbies include reading books and hang out with friends is his most favorite past time hobby.


1. 20 Apr 2014: Best Mobile Article of March 2014 - First Prize

Comments and Discussions

 
-- There are no messages in this forum --