473,513 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 17 '05 #1
2 2207
Take a look at this article:

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

Crouchie1998
BA (HONS) MCP MCSE
Nov 17 '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 17 '05 #3

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

Similar topics

0
289
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
2814
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
2458
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
7883
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
2261
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
6242
by: Armin Bajramovic | last post by:
Hi, I have enum: public enum StatusEnum { Active = 'A', Nonactive = 'N', Deleted = 'D' }
1
2627
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
1571
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
1598
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
2344
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
7257
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7098
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
7521
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
5682
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,...
1
5084
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...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1591
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.