using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MECF.Framework.Common.Extens { public static class DictionaryExtensions { public static void TryAddValue(this Dictionary> dictionary, TKey key, TValue value) { if (dictionary.ContainsKey(key)) { dictionary[key].Add(value); } else { dictionary.Add(key, new List { value }); } } public static void TryAddValue(this Dictionary dictionary, TKey key, TValue value) { if (dictionary.ContainsKey(key)) { dictionary[key] = value; } else { dictionary.Add(key, value); } } } }