How to use C# NameValueCollection Class
NameValueCollection is used to store a collection of associated String keys and String values that can be accessed either with the key or with the index. It is very similar to C# HashTable, HashTable also stores data in Key , value format .
NameValueCollection can hold multiple string values under a single key. As elements are added to a NameValueCollection, the capacity is automatically increased as required through reallocation. The one important thing is that you have to import System.Collections.Specialized Class in your program for using NameValueCollection.
Adding new pairs
NameValueCollection.Add(name,value) NameValueCollection pair = new NameValueCollection(); pair.Add("High", "80");
Get the value of corresponding Key
string NameValueCollection.GetValues(index); NameValueCollection pair = new NameValueCollection(); pair.Add("High", "80"); string vals = pair.GetValues(1);