PkmnLib.NET/PkmnLib.Static/Utils/DictionaryHelpers.cs

12 lines
331 B
C#
Raw Normal View History

2025-01-26 09:48:13 +00:00
namespace PkmnLib.Static.Utils;
public static class DictionaryHelpers
{
2025-03-02 16:19:57 +00:00
public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key,
TValue defaultValue)
2025-01-26 09:48:13 +00:00
{
if (dictionary.TryGetValue(key, out var value))
return value;
return defaultValue;
}
}