Code:
XDocument xDoc = XDocument.Parse(xml); var elem = (from xElem in xDoc.Root.Elements() where xElem.Name == "DemoXML" select xElem).First(); // The best!!! // MSDN recommended // using System.Xml.XPath; var res1 = xDoc.Root.XPathSelectElement("MyData/Name");
Leave a comment: