title: GetSection object cannot be cast to IDictionary<>
body: <p>I hope I'm just missing something simple. I need to read/write to a section of my exe.config file. I have this in my code:</p>
  
  <pre><code>var appConfiguration = ConfigurationManager.OpenExeConfiguration("Mytest.Console.exe");
  var fileEnvironment = appConfiguration.GetSection("fileEnvironment");
  </code></pre>
  
  <p>and this is my app.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
          &lt;section name="fileEnvironment" type="System.Configuration.DictionarySectionHandler"/&gt;
      &lt;/configSections&gt;
  
      &lt;fileEnvironment&gt;
          &lt;add key="TestEntry1" value="A nice value"/&gt;
          &lt;add key="TestEntry2" value="Another value"/&gt;
      &lt;/fileEnvironment&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>My appConfiguration variable is returned as {System.Configuration.Configuration} and the "HasFile" property is set to true.</p>
  
  <p>Without casting my variable "fileEnvironment" is returned as <code>System.Configuration.DefaultSection</code>. When I add as <code>IDictionary&lt;string, string&gt;</code> to the <code>GetSection</code> method fileEnvironment is null.</p>
  
  <p>Any ideas?</p>