List
xDoc.Descendants("CollectionItem")
.SelectMany(ci => ci.Descendants("ProductType"))
.Select(pt => pt.Value).Distinct().ToList();
this will return a List<> with all the Distinct ProductType Values under the CollectionItem node of the xml file.
.SelectMany because we want all of the values for ProductType
.Select says we want the Value of the node and only want Distinct ones.
No comments:
Post a Comment