using System.Collections.Generic; namespace MonoGame.Extended.Collections { public static class DictionaryExtensions { public static TValue GetValueOrDefault(this Dictionary dictionary, TKey key) { return GetValueOrDefault(dictionary, key, default(TValue)); } public static TValue GetValueOrDefault(this Dictionary dictionary, TKey key, TValue defaultValue) { TValue value; return dictionary.TryGetValue(key, out value) ? value : defaultValue; } } }