Multiple Keys

S

shahid.juma

Using NameValueCollection, is this possible:

my.Add ("1", "VALUE");
my.Add ("1", "VALUE");
my.Add ("2", "VALUE");
my.Add ("2", "VALUE");

Also, how do I iterate through it and print the values that have been
stored.

Thanks in advance,
Shahid
 
C

CodeMeister

Yes, you can use repeating key values in a NameValueCollection. When you
retrieve the values, they will be in a comma separated list format

I'm not sure if there is another way to get the values but here's one
method:

foreach(string key in my.Keys)
{
string item = my[key];
}

I hope this helps.

Jon
 

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