using System.Collections.Generic; namespace HC { public static class HCExtensions { public static void AddIfNotExists(this IDictionary dictionary, TKey key, TValue value) { if (!dictionary.ContainsKey(key)) dictionary.Add(key, value); } public static TValue GetValue(this IDictionary dictionary, TKey key, TValue defalut) { return dictionary.TryGetValue(key, out var value) ? value : defalut; } } }