I would like to get all values which Intersect from this LINQ query:
Where(x => x.Attribute("name").Value).Intersect(myList).Any();
I don't know how to add a select.
I would like to get all values which Intersect from this LINQ query:
Where(x => x.Attribute("name").Value).Intersect(myList).Any();
I don't know how to add a select.
I'm assuming the you want all the Attribute("name").Value that are in myList
You can either do
Where(x=>myList.Contains(x.Attribute("name").Value)).Select(x=>x.Attribute("name").Value)
or
Select(x=>x.Attribute("name").Value).Intersect(myList)
Why do you do intersection? Why don't just List.Contains?
data.Where(x => myList.Contains(x.Attribute("name").Value).ToList();
or
data.Select(x => x.Attribute("name").Value).Intersect(myList);