User364803292 posted
Hello
I need to select a number of decendant elements from an xml document.
Currently I have the following:
myXElement.Descendants().
Where(x => x.Name == "MySubNodeName").ToList().
ForEach(x => myObjectList.Add(SetUpObjectFromNode(x)));
What I need is to get the node names that set the where clause from a database or an app.config file.
So I will have a list of Strings that must form the where conditions.
eg. if the list of conditions returned from db or app.config is:
List<String> conditions = new List<String>{"MySubNodeName1", "MySubNodeName2", "MySubNodeName3"}
the select from myXElement must become:
myXElement.Descendants().
Where(x => x.Name == "MySubNodeName1" || x.Name == "MySubNodeName2" || x.Name == "MySubNodeName3" || ).ToList().
ForEach(x => myObjectList.Add(SetUpObjectFromNode(x)));
Is that possible?