title: Reading XML to get value of a tag c#
body: <p>I have my XML as</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;   
   &lt;recordsDirectory&gt;F:/model_RCCMREC/&lt;/recordsDirectory&gt; 
   &lt;transferDirectory&gt;F:/model_RCCMrecTransfered/&lt;/transferDirectory&gt;
   &lt;logDirectory&gt;F:/model_RCCMLOG/&lt;/logDirectory&gt;
   &lt;connectionstring&gt;Data Source=192.168.1.7;Initial Catalog=RCCMdb;User ID=genesys;Password=genesys&lt;/connectionstring&gt;  
    &lt;table&gt;RCCMrec&lt;/table&gt; 
      &lt;DBdestination&gt;
      &lt;val1&gt;ANI&lt;/val1&gt;
      &lt;val2&gt;DNIS&lt;/val2&gt;
      &lt;val3&gt;Date&lt;/val3&gt;
      &lt;val4&gt;Time&lt;/val4&gt;
      &lt;val5&gt;ConnId&lt;/val5&gt;
      &lt;val6&gt;UUID&lt;/val6&gt;
      &lt;val7&gt;EmployeeId&lt;/val7&gt;
      &lt;val8&gt;AgentDN&lt;/val8&gt; 
      &lt;/DBdestination&gt;   
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I need the value of the recordsDirectory tag.
  I tried this, </p>
  
  <pre><code>XmlDocument xmldoc = new XmlDocument(); 
  xmldoc.Load("C:/Users/yachna/Desktop/RCCM_TOOL/configRCCM.xml");
  string bvalue = xmldoc.SelectSingleNode("recordsDirectory").InnerText.ToString();
  </code></pre>
  
  <p>But got an error saying</p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
  </blockquote>