473,322 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

An object that handles Name=Value pairs?

Is there an object in the .NET framework that has methods for working
with Name=Value pairs such as those in a connection string?

What I am looking for is something similar to an ArrayList but with an
IndexOfName method that will find the first occurance of the value on
the left of the = sign and that also has a way to change the Value on
the right side.

--
Bill
Nov 15 '05 #1
2 8412
Look at the NameValueCollection

int loop1, loop2;

NameValueCollection coll=Request.QueryString;

// Get names of all keys into a string array.

String[] arr1 = coll.AllKeys;

for (loop1 = 0; loop1 < arr1.Length; loop1++)

{

Response.Write("Key: " + arr1[loop1] + "<br>");

String[] arr2 = coll.GetValues(arr1[loop1]);

for (loop2 = 0; loop2 < arr2.Length; loop2++)

{

Response.Write("Value " + loop2 + ": " + arr2[loop2] +
"<br>");

}

}

"Bill Todd" <no@no.com> wrote in message
news:g9********************************@4ax.com...
Is there an object in the .NET framework that has methods for working
with Name=Value pairs such as those in a connection string?

What I am looking for is something similar to an ArrayList but with an
IndexOfName method that will find the first occurance of the value on
the left of the = sign and that also has a way to change the Value on
the right side.

--
Bill

Nov 15 '05 #2
Empire City <a@b.com> wrote:
Look at the NameValueCollection


And if you only need a single value per name, just HashMap or
StringDictionary, depending on the exact needs.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3

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

Similar topics

7
by: Woodster | last post by:
Further to a question I posted here recently about coding an xml rpeort parser, I need to use a list of name/value pairs, in this case, a list property names and values for a given tag. Rather...
4
by: Bill | last post by:
If, for example, I retrieve a connectionstring from a config file using something like: Value = ConfigurationSettings.AppSettings; This will return a string that is semi-colon delimited. If I...
2
by: Astra | last post by:
Hi everybody Need your help. I have a DB-extracted list of say 5 items per page, which have links on each one that takes you to more detailed info on the 'clicked' particular item. When you...
16
by: Bush is a Fascist | last post by:
Hi all, What do most languages call a name-value pairing? Or perhaps my question should be, why not just call it a name-value pairing? Too many syllables? Did Knuth invent a handy term for...
0
by: I R BABOON | last post by:
0. Assume an application can send data using HTTP POST. 1. For some reason, it sends the name value pairs using the syntax x.y -- which is perfectly acceptable in HTML forms. 2. Now I want to...
1
by: Isz | last post by:
Dear group: I am inexperienced in more advanced csharp techniques such as interfaces/interfaces/collections etc. But here is what I would like to do: I have an object in MM Flash that...
1
by: Bill | last post by:
I have strings returned from a config file that contain zero or more name/value pairs using a pattern like "name = value;" I want to extract the value of a given name (passwords, etc.). I want...
6
by: Andy Sutorius via DotNetMonster.com | last post by:
Hi, What collection can I use to store name value pairs that contain duplicates in both columns? Thanks, Andy --
1
by: ozzii | last post by:
Hi, Does anybody know how to parse the name value pairs in a querystring contained in a variable with asp? for those of you who might be confused, what i am trying to do is basically I have a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.