473,397 Members | 1,972 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,397 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
Jul 21 '05 #1
2 2451
Take a look at this article:

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

Crouchie1998
BA (HONS) MCP MCSE
Jul 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

Jul 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...
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' }
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>...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.