Removing Duplicates from a List in C#

24. December 2009 18:25

.NET Framework C# Code Snippets  0 Comments

For more details and detailed explaination of the code visit this link.

static List removeDuplicates(List inputList)
        {

            Dictionary uniqueStore = new Dictionary();
            List finalList = new List();
	    foreach (string currValue in inputList)
            {

                if (!uniqueStore.ContainsKey(currValue))
                {

                    uniqueStore.Add(currValue, 0);
                    finalList.Add(currValue);

                }

            }
            return finalList;
         }
 No Rating

Comments (0)

Add Comment

Visit blogadda.com to discover Indian blogs Computers Blogs