I'd like to loop through the following custom app.config key:
----
<configSections>
<sectionGroup name="StemmerSettings">
<section name="catalog_1"
type="System.Configuration.NameValueSectionHandler ,system,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,
Custom=null" />
<section name="catalog_2"
type="System.Configuration.NameValueSectionHandler ,system,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,
Custom=null" />
<section name="catalog_3"
type="System.Configuration.NameValueSectionHandler ,system,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089,
Custom=null" />
</sectionGroup>
</configSections>
<StemmerSettings>
<catalog_1>
<add key="dbconn" value="SERVER="connection string 1">
<add key="stemmer" value="Italian"/>
</catalog_1>
<catalog_2>
<add key="dbconn" value="SERVER="connection string 2">
<add key="stemmer" value="French"/>
</catalog_2>
<catalog_3>
<add key="dbconn" value="SERVER="connection string 3">
<add key="stemmer" value="French"/>
</catalog_3>
</StemmerSettings>
----
Essentially I'd like to return:
catalog_1
catalog_2
catalog_3
Is there anyway to accomplish this? I've tried:
public SortedList GetCatalogList()
{
SortedList _catalogList = new SortedList();
NameValueCollection nvc =
(NameValueCollection)ConfigurationSettings.GetConf ig("StemmerSettings");
foreach (string s in nvc.Keys)
{
_catalogList.Add( s, nvc[s] );
}
return _catalogList;
}