title: C# GET XML TAG VALUE
body: <p>I have an xml file  named <code>BackupManager.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
  &lt;Settings&gt;
  &lt;directory id="backUpPath" value="D:/BACKUPS/"&gt;&lt;/directory&gt;
  &lt;filename id="feilname" value="SameName"&gt;&lt;/filename&gt;
  &lt;period id ="period" value="15"&gt;&lt;/period&gt;
  &lt;/Settings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I am trying to get value from the tags to a  string
  Eg:- I need value of 'backUpPath' tag as 'D:/BACKUPS/' to a string say 'str'</p>
  
  <p>The code I have tried is </p>
  
  <pre><code>XmlDocument infodoc = new XmlDocument();
  infodoc.Load("BackupManager.xml");
  //int col = infodoc.GetElementsByTagName("directory").Count;
  String str = infodoc.GetElementByID("directory").value;
  </code></pre>
  
  <p>But i am getting null value on 'str'</p>