CSharp examples for System.Collections.Generic:IDictionary
A Dictionary<string,string> extension method that converts a map to a name value collection.
using System.Collections.Specialized; using System.Collections.Generic; public class Main{ /// <summary>A Dictionary<string,string> extension method that converts a map to a name value collection.</summary> /////w w w. j a va 2 s . co m /// <param name="map">The map to act on.</param> /// /// <returns>map as a NameValueCollection.</returns> public static NameValueCollection ToNameValueCollection(this Dictionary<string, string> map) { if (map == null) return new NameValueCollection(); var nameValues = new NameValueCollection(); foreach (var item in map) { nameValues.Add(item.Key, item.Value); } return nameValues; } }