NameValueCollection.GetValues and array especification

A

Alfons Puig

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>
............
Which should be the format of ????? in order to work with the following
piece of code?

Dim Parameters as NameValueCollection
Dim P1() as String
Dim P2 as String

Parameters = CType(ConfigurationSettings.GetConfig("AA/BB"),
Specialized.NameValueCollection)

P1 = Parameters.GetValues("P1")
P2 = Parameters.Get("P2")

Thanks,

Alfons Puig
(e-mail address removed)
 
S

Shaji

Store comma (or anyother charector) seperated value in the P1

e.g
<add key="P1" value="Element 1,Element 2, Element 3">

Then use "Split" to get each string into the array.
P1 = Split(Parameters.GetValues("P1"),",")


Shaji
www.DiverseInc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top