Suppose I want to return the value that has the XPath “/Tier1/Tier2/Setting[Name=aUniqueName]/theValue”
I’m using XDocument so I can use linq, but is there short way to get this value with proper error checking? All I can think of is to get each tier, check each tier is not null, then proceed to the next tier and repeat – which seems a lot more effort than using a single line of XPath in XmlDocument.
You can use XPath with
XDocument. UseXPathSelectElementsmethod.