Schuster Efigenio

Schuster Efigenio

  • NA
  • 20
  • 19.7k

Generic List Distinct

Jul 28 2011 6:57 AM
Hi Guys,

I have a list with duplicate items and would list to remove duplicates.

I have tried several approaches and none of them seem to have worked.

Here is my code that I have to populate the list.


public class Skills

{

public string Name { get; set; }


}


XDocument xdoclist = XDocument.Load(new XmlNodeReader(xdoc4));



List<Skills> primaryProductSkills = (from xml in xdoclist.Elements("product_parent").Elements("product").Elements("comp").Elements("skill")
select new Skills

{

Name = xml.Element("skill").Value,

}).ToList();


Thanks



Answers (5)