CSharp examples for System.Collections.Generic:IDictionary
Add a value to the dictionary with the key and return this dictionary.
using System.Linq; using System.Diagnostics.Contracts; using System.Collections.Generic; using System;/* w ww . j a v a 2s. c om*/ public class Main{ /// <summary> /// Add a value <paramref name="val"/> to the <paramref name="dictionary"/> /// with the key <paramref name="key"/> and return this dictionary. /// </summary> public static IDictionary<TKey, TVal> With<TKey, TVal>(this IDictionary<TKey, TVal> dictionary, TKey key, TVal val) { Contract.Requires(dictionary != null); dictionary.Add(key, val); return dictionary; } }