How to Get an XML Element from XDocument using LINQ ?
Suppose I have an XDocument Named XMLDoc which is shown below:
<Contacts>
<Node>
<ID>123</ID>
<Name>ABC</Name>
</Node>
<Node>
<ID>124</ID>
<Name>DEF</Name>
</Node>
</Contacts>
XElement Contacts = from xml2 in XMLDoc.Elements("Contacts").Elements("Node")
where xml2.Element("ID").Value == variable
select xml2;
But I am getting Error "Object Reference is NOT to set....."
How to get a particular Node from a XML file using LINQ? I want to update some values in that node.
How can this be done?