title: How to get the values of a ConfigurationSection of type NameValueSectionHandler
body: <p>I'm working with C#, Framework 3.5 (VS 2008).</p>
  
  <p>I'm using the <code>ConfigurationManager</code> to load a config (not the default app.config file) into a Configuration object.</p>
  
  <p>Using the Configuration class, I was able to get a <code>ConfigurationSection</code>, but I could not find a way to get the values of that section.</p>
  
  <p>In the config, the <code>ConfigurationSection</code> is of type <code>System.Configuration.NameValueSectionHandler</code>.</p>
  
  <p>For what it worth, when I used the method <code>GetSection</code> of the <code>ConfigurationManager</code> (works only when it was on my default app.config file), I received an object type, that I could cast into collection of pairs of key-value, and I just received the value like a Dictionary. I could not do such cast when I received <code>ConfigurationSection</code> class from the Configuration class however.</p>
  
  <p>EDIT:
  Example of the config file:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="MyParams" 
               type="System.Configuration.NameValueSectionHandler" /&gt;
    &lt;/configSections&gt;
  
    &lt;MyParams&gt;
      &lt;add key="FirstParam" value="One"/&gt;
      &lt;add key="SecondParam" value="Two"/&gt;
    &lt;/MyParams&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Example of the way i was able to use it when it was on app.config (the "GetSection" method is for the default app.config only):</p>
  
  <pre><code>NameValueCollection myParamsCollection =
               (NameValueCollection)ConfigurationManager.GetSection("MyParams");
  
  Console.WriteLine(myParamsCollection["FirstParam"]);
  Console.WriteLine(myParamsCollection["SecondParam"]);
  </code></pre>