title: Getting section name from configSections on App.Config file
body: <p>I'd like to know a way to get all the sections names inside the tag configSections on my App.Config file.</p>
  
  <p>So far what I've found is something like this:</p>
  
  <pre><code>var cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
  var localSections = cfg.Sections.Cast&lt;ConfigurationSection&gt;().Where(s =&gt; s.SectionInformation.IsDeclared);
  </code></pre>
  
  <p>But for some reason localSections always appears to be null.
  Here is how my app.config file looks like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
  &lt;startup&gt; 
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&gt;
  &lt;/startup&gt;
  &lt;appSettings&gt;
    &lt;add key="frequency" value=""/&gt;
  &lt;/appSettings&gt;
  &lt;configSections&gt;
    &lt;section name="Name1" type="System.Configuration.NameValueSectionHandler" /&gt;
    &lt;section name="Name2" type="System.Configuration.NameValueSectionHandler"/&gt;
  &lt;/configSections&gt;
  &lt;Name1&gt;
    &lt;add key="active" value="on"/&gt;
    &lt;add key="repeat" value="off"/&gt;
  &lt;/Name1&gt;
  &lt;Name2&gt;
    &lt;add key="active" value="on"/&gt;
    &lt;add key="repeat" value="off"/&gt;
  &lt;/Name2&gt;
  &lt;/configuration&gt;
  </code></pre>