473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

AppSettingsReader GetValues

Hi,
Consider following app.config

<configuration>
<appSettings>
<add key="Fields" value="Field1" />
<add key="Fields" value="Field2" />
<add key="Fields" value="Field3" />
</appSettings>
</configuration>

Is there any way to retrieve all three values for one key.
Its very possible and easy in an XML Document ( infact i do it but as an
app.config.xml ).
So the AppSettingsReader provide ONLY ONE method GetValue and the internal
XML Document isnt exposed.

ReQuote: How to get multiple values on same key from an app.config file ?
Something Like GetValues( key, values() )

So is there a way to do it without writing own XML document parsing code?

Thanx in advance
rawCoder
Nov 21 '05 #1
2 1719
Take a look at this article:

http://www.gotdotnet.com/Community/U...5-0a217c8eb94c

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
Hey,

Take a look at using the ConfigurationSettings.GetConfig() method. I found
the the help file to be of almost negative assistance. Here's a link that's
helped me along:

http://dotnet247.com/247reference/a....ionHandler.asp

Basically, you can define configuration sections that can be mapped to a
class you define in code, which can contain pretty much any representation
of the data you want.

HTH,

John

"rawCoder" <ra******@hotmail.com> wrote in message
news:uv*************@tk2msftngp13.phx.gbl...
Hi,
Consider following app.config

<configuration>
<appSettings>
<add key="Fields" value="Field1" />
<add key="Fields" value="Field2" />
<add key="Fields" value="Field3" />
</appSettings>
</configuration>

Is there any way to retrieve all three values for one key.
Its very possible and easy in an XML Document ( infact i do it but as an
app.config.xml ).
So the AppSettingsReader provide ONLY ONE method GetValue and the internal
XML Document isnt exposed.

ReQuote: How to get multiple values on same key from an app.config file ?
Something Like GetValues( key, values() )

So is there a way to do it without writing own XML document parsing code?

Thanx in advance
rawCoder

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marty McDonald | last post by:
We've created our own configuration handler. Some of our existing apps currently have... AppSettingsReader MyConfigRdr = new AppSettingsReader(); string strConfigValue =...
2
by: smith | last post by:
It's a time saver to "bind" .Net enums to list and comboboxes and all the samples out there seem to use GetNames and GetValues pretty interchangeably. So I was wondering what the logic is to the...
2
by: rawCoder | last post by:
Hi, Consider following app.config <configuration> <appSettings> <add key="Fields" value="Field1" /> <add key="Fields" value="Field2" /> <add key="Fields" value="Field3" /> </appSettings>...
3
by: Lloyd Dupont | last post by:
for this config file: //-------- <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Lion's Port" value="1971"/> </appSettings> </configuration> //--------
6
by: Gabriël | last post by:
Hi Folks, I've tried to do the following: public enum AssetType { Requested, InOrder, Received, InPlace, Gone }; (...) dropAssetType.DataSource = Enum.GetValues(AssetType); (...) For some...
2
by: Armin Bajramovic | last post by:
Hi, I have enum: public enum StatusEnum { Active = 'A', Nonactive = 'N', Deleted = 'D' }
1
by: Alfons Puig | last post by:
I need to specify an string array as a value in a NameValueCollection in web.config file ......... <AA> <BB> <add key="P1" value=?????> <add key="P2" value="String"> </BB> </AA>
0
by: Matt Adamson | last post by:
Guys, When writing unit tests for our assemblies we'd like to change configuration values at runtime for some tests i.e. to test all code paths are executed. e.g. one method would create a test...
0
by: Tina | last post by:
I have googled several articles on how to get an AppSettings out of the web.config and into a string in C# and none of them work. The following code gets an error on the = sign in myString = I...
1
by: Jeff Mason | last post by:
I am observing some puzzling behavior with the GetValues method of enumerations. I wonder if this something I just don't understand, or is this just wrong. The documentation for the GetValues...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.