title: Reading keyvalue pairs into dictionary from app.config configSection
body: <p>I currently have an app.config in an application of mine set up like so:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="DeviceSettings"&gt;
        &lt;section name="MajorCommands" type="System.Configuration.DictionarySectionHandler"/&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;appSettings&gt;
      &lt;add key="ComPort" value="com3"/&gt;
      &lt;add key="Baud" value="9600"/&gt;
      &lt;add key="Parity" value="None"/&gt;
      &lt;add key="DataBits" value="8"/&gt;
      &lt;add key="StopBits" value="1"/&gt;
      &lt;add key="Ping" value="*IDN?"/&gt;
      &lt;add key="FailOut" value="1"/&gt;
    &lt;/appSettings&gt;
    &lt;DeviceSettings&gt;
      &lt;MajorCommands&gt;
        &lt;add key="Standby" value="STBY"/&gt;
        &lt;add key="Operate" value="OPER"/&gt;
        &lt;add key="Remote" value="REMOTE"/&gt;
        &lt;add key="Local" value="LOCAL"/&gt;
        &lt;add key="Reset" value="*RST" /&gt;
      &lt;/MajorCommands&gt;
    &lt;/DeviceSettings&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>My current objective is to foreach or simply read all values from MajorCommands into a <code>Dictionary&lt;string, string&gt;</code> formatted as <code>Dictionary&lt;key, value&gt;</code>. I've tried several different approaches using System.Configuration but none seem to work and I haven't been able to find any details out there for my exact question. Is there any proper way to do this?</p>