NameValueCollection.GetValues and array especification

  • Thread starter Thread starter Alfons Puig
  • Start date Start date
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)
 
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
 
Back
Top