Home
Manage Your Code
Snippet: Get Collection of web/app config setting by group (C#)
Title: Get Collection of web/app config setting by group Language: C#
Description: Gets a namevaluecollection populated with a section of setting within a web/app config file in .net 2.0 applications Views: 187
Author: Steve Vasquez Date Added: 10/5/2007
Copy Code  
1<!-- web/app config example -->
2
3<SectionName>
4
5<add key="key1" value="value1"/>
6<add key="key2" value="value2"/>
7<add key="key3" value="value3"/>
8
9</SectionName>
10
11
12// C# code example to get back the above values from config in a single collection.

13
14NameValueCollection configSettings = (NameValueCollection)ConfigurationManager.GetSection("SectionName");
Usage
Get a collecion of config setting by a section name.