title: Custom ASP.NET Configuration Section
body: <p>I want to create a custom configuration section to handle email notifications. The configuration needs to be in the following format:</p>
  
  <pre><code>&lt;configSections&gt;
      &lt;sectionGroup name="notifications"&gt;
          &lt;section name="notification" type="NotificationConfiguration" allowLocation="true" allowDefinition="Everywhere" /&gt;
      &lt;/sectionGroup&gt;
  &lt;/configSections&gt;
  ...
  &lt;notifications&gt;
      &lt;notification name="..." enabled="..." delayInMinutes="..."&gt;
          &lt;recipients&gt;
              &lt;add email="..." /&gt;
              &lt;add email="..." /&gt;
              &lt;add email="..." /&gt;
          &lt;/recipients&gt;
      &lt;/notification&gt;
      &lt;notification name="..." enabled="..." delayInMinutes="..."&gt;
          &lt;recipients&gt;
              &lt;add email="..." /&gt;
              &lt;add email="..." /&gt;
              &lt;add email="..." /&gt;
          &lt;/recipients&gt;
      &lt;/notification&gt;
  &lt;/notifications&gt;
  ...
  </code></pre>
  
  <p>I can get this to work fine using <code>NotificationConfiguration config = (NotificationConfiguration) ConfigurationManager.GetSection("notifications\notification")</code>, but this only caters for one <code>&lt;notification&gt;</code> element. How do I accomplish multiple elements to accommodate more than one notification?</p>
  
  <p>The class that handles this is quite lengthy, so I won't paste it here, but it can be downloaded from here:</p>
  
  <p><a href="http://files.getdropbox.com/u/288235/NotificationConfiguration.cs" rel="nofollow noreferrer">http://files.getdropbox.com/u/288235/NotificationConfiguration.cs</a></p>
  
  <p>Thanks.</p>