using System; using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace BS.Shared.Extensions { public static class DictionaryExtensions { public static T2 GetValueOrDefault(this Dictionary dictionary, T1 key, T2 t_default) { if (dictionary is null || !dictionary.Any()) return t_default; if (dictionary.TryGetValue(key, out var val)) { return val; } return t_default; } } }