using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace UIInfoSuite.Extensions { static class CollectionExtensions { public static TValue SafeGet(this IDictionary dictionary, Tkey key, TValue defaultValue = default(TValue)) { TValue value = defaultValue; if (dictionary != null) { if (!dictionary.TryGetValue(key, out value)) value = defaultValue; } return value; } } }