I have code like this:
string result = xml.Root.Descendants("XYZ").Descendants("ABC").Descendants("MNO").Single().Value;
1) Is there a better way to read the value? Some way generic that is not dependent on the nuber of nodes deep that I have to go?
2) What would be the approach to remove the hard-coded dependency on “XYZ”, “ABC” etc. ?
It’s unclear what you really mean, but is this what you’re after?
Then you can call: