title: Is there a way to use a Dictionary-like collection as an Application Settings object?
body: <p>I'd like to store a set of key/value pairs in the application settings of my ASP.NET web app, but I'm not finding a straightforward way to do that.  For example, these <a href="https://stackoverflow.com/questions/424010/stringdictionary-not-saving-as-user-setting">two</a> <a href="https://stackoverflow.com/questions/922047/store-dictionarystring-string-in-application-settings">questions</a> tell me that StringDictionary etc. won't serialize to XML and suggest that I'll have to roll my own implementation.  But it seems like this should be easier to do; after all, web.config is XML and &lt; applicationSettings> is essentially a collection of key/value pairs, so it feels like I'm missing something obvious.  Given my specific case below, do I really have to roll my own serialization, or is there an easier workaround?</p>
  
  <p>The web app in question is a basic contact form that sends email to different recipients based on the value of a parameter; e.g. <a href="http://www.examplesite.com/Contact.aspx?recipient=support" rel="nofollow noreferrer">http://www.examplesite.com/Contact.aspx?recipient=support</a> would send email to SupportGroup@exampledomain.com.</p>
  
  <p>The goal is to be able add or remove recipients (or change their addresses) by editing the web.config file so that I don't have to recompile and can easily maintain different configurations in test and production environments.  For example:</p>
  
  <pre><code>// I can use something like this for the sender address
  SmtpMsg.From = New MailAddress(My.Settings.EmailSender)
  
  // And then just edit this part of web.config to use 
  // different addresses in different environments.
  &lt;setting name="EmailSender" serializeAs="String"&gt;
   &lt;value&gt;webcontact@exampledomain.com&lt;/value&gt;
  &lt;/setting&gt;
  
  // I want something like this for the recipients
  SmtpMsg.To.Add(My.Settings.Recipients("support"))
  
  // and presumably some sort of equivalent xml in web.config
  // maybe something like this???
  &lt;recipients&gt;
    &lt;item name="support" serializeAs="String"&gt;
     &lt;value&gt;SupportGroup@exampledomain.com&lt;/value&gt;
    &lt;/item&gt;
    &lt;!-- add or remove item elements here --&gt;
  &lt;/recipients&gt;
  </code></pre>
  
  <p>edit: replaced VB comments w/ C# comments because of the code-coloring</p>