Linq XML query - How do I return a node that meets a condition within its own nested nodes?

This is a good case for using XPath: RootElement. XPathSelectElements("//administratorprovinces/province = '" + provinceId + "'").

Sweet Betsy! Good answer - thanks! – FiveTools Mar 17 at 22:46.

Var admins = RootElement. Elements("administrator") . Where( a => a.

Descendants("province"). Any( p => int. Parse(p.

Value) == provinceId ) ).

IEnumerable admins = RootElement. Elements("administrator") . Where(x => x.

Elements("provinces") . SelectMany(p => p. Elements("province")) .

Any(p => int. Parse(p. Value) == provinceId)) .

Select(x => new Administrator() { FullName = x. Element("fullname"). Value, Email = x.

Element("email"). Value }); (I have not yet tested this. ).

IEnumerable admins = RootElement. Where(x => x.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions