CSharp examples for System.Collections.Generic:IDictionary
Add or set key value pair in Dictionary
using System.Linq; using System.Text; using System.Globalization; using System.ComponentModel; using System.Collections.Generic; using System.Collections; public class Main{ public static void Set<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue value) {/*from ww w . jav a 2 s. c o m*/ if (dictionary.ContainsKey(key)) dictionary[key] = value; else dictionary.Add(key, value); } }