Monday, January 25, 2010
Custom sections are created by declaring the section name in the <configsections> element, and then declaring the section, like so:

<section name="MyCustomSection" type="System.Configuration.NameValueFileSectionHandler"/>

  <MyCustomSection>
    <add key="KEY1" value="VAL1"/>
    <add key="KEY2" value="VAL2"/>
</MyCustomSection>


This is then read in as follows:


            NameValueCollection myList= (NameValueCollection)
                ConfigurationManager.GetSection("MyCustomSection");
            return myList[scenario];

Simples.

Monday, January 25, 2010 1:33:23 PM (GMT Standard Time, UTC+00:00) | Comments [0] | c##
Search
Archive
Links
Categories
Admin Login
Sign In
Blogroll