NameValueCollection Class

Overview

  • Acts like a StringDictionary which can contain duplicate keys.
  • Values can be retrieved by key and index.

Good practice

Examples

Simple Usage

NameValueCollection valueCollection = new NameValueCollection();
 
valueCollection.Add("Key1", "Value1");
valueCollection.Add("Key1", "Value2");
valueCollection.Add("Key2", "Value3");
 
foreach (string s in valueCollection.Keys)
{
    Console.WriteLine(valueCollection[s]);
}