Configuration Manager Settings

  • Thread starter Thread starter Barry
  • Start date Start date
B

Barry

Hi

is it possible to have a node like the following (appUsers) in the
App.config file in a .Net Framework (2.00) app

<appSettings>
<add key="AppSetting0" value="Monday, February 28, 2005 1:27:59 PM" />
<appUsers>
<add key="user1" value="xxx-1" />
<add key="user2" value="xxx-2" />
<add key="user3" value="xxx-3" />
<add key="user4" value="xxx-4" />
<add key="user5" value="xxx-5" />
</appUsers>
</appSettings>

if not is there a way out of this

TIA
Barry
 
Barry said:
Hi

is it possible to have a node like the following (appUsers) in the
App.config file in a .Net Framework (2.00) app

<appSettings>
<add key="AppSetting0" value="Monday, February 28, 2005 1:27:59 PM" />
<appUsers>
<add key="user1" value="xxx-1" />
<add key="user2" value="xxx-2" />
<add key="user3" value="xxx-3" />
<add key="user4" value="xxx-4" />
<add key="user5" value="xxx-5" />
</appUsers>
</appSettings>

if not is there a way out of this

TIA
Barry
Can you elaborate on what you are trying to accomplish with these keys?
 
I have an app in which the clients wants to ignore processing of records
which have a specific code (the word User is only for illustration) and the
client want to store these codes in the app.config file

i just want to iterate through the codes (herein called User)

i have used this

<appSettings>
<add key="user1" value="xxx-1" />
<add key="user2" value="xxx-2" />
<add key="user3" value="xxx-3" />
<add key="user4" value="xxx-4" />
<add key="user5" value="xxx-5" />
</appSettings>

in the code i iterate like this

for (int i = 1; i <= 100; i++)
{
string strCode = ConfigurationManager.AppSettings["user" +
i.ToString()];
if (strCode != null)
{
_arrIgnoreCodes.Add(strCode.Trim());
}
}

I find this a bit crude.
 
Back
Top