Board index » Visual Studio » AppSettingsReader GetValues

AppSettingsReader GetValues

Visual Studio26
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


-
 

Re:AppSettingsReader GetValues

Re:AppSettingsReader GetValues

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.aspx?u" rel="nofollow" target="_blank">dotnet247.com/247reference/a.aspx=www.codeproject.com/csharp/ConfigSectionHandler.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" <rawCoder@hotmail.com>wrote in message

Quote
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









-