mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
13 lines
319 B
C#
13 lines
319 B
C#
namespace JetKarmaBot;
|
|
|
|
public static class IReadOnlyDictionaryExtensions
|
|
{
|
|
public static TValue GetOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key)
|
|
{
|
|
TValue res = default;
|
|
if (key != null)
|
|
dict.TryGetValue(key, out res);
|
|
return res;
|
|
}
|
|
}
|