using System;
using System.Collections.Specialized;
public class Program
{
public static void Main()
// this compiles
/*
NameValueCollection nvc = new NameValueCollection();
nvc.Add("foo", "bar");
nvc.Add("hello", "world");
*/
// but this doesn't compile
NameValueCollection nvc = new NameValueCollection()
["foo"] = "bar",
["hello"] = "world"
};
foreach (string name in nvc)
Console.WriteLine(nvc[name]);
}