using System.Collections; using System.Collections.Generic; namespace AV.Inspector { internal static class DictionaryUtils { public static void TryRemove(this Dictionary lookup, TKey key) { if (lookup.ContainsKey(key)) lookup.Remove(key); } public static void TryAdd(this Dictionary lookup, TKey key, TValue value) { if (!lookup.ContainsKey(key)) lookup.Add(key, value); } public static void AddOrAssign(this Dictionary lookup, TKey key, TValue value) { if (!lookup.ContainsKey(key)) lookup.Add(key, value); else lookup[key] = value; } } }