Good day, Hashcode.
Monday is a tough day, and it looks like I finally turned over.
There is the simplest xml document:
<Шапка> <error code="40" message="Can not login." /> </Шапка>
It is required to get "40" from there.
From my point of view, you need to get the value of the code attribute of the error element.
Type of such:
return (from node in xdoc.Descendants() select node.Element("error").Attribute("code").Value).First();
Does not work. Why? How to write correctly? It’s a shame to go to StackOverflow with this question :)
And after all, this is the same thing as:
<Шапка> <error> <code>40</code> <message>Can not login</message> </error> </Шапка>
Right?