Adds bind
This commit is contained in:
11
PkmnLib.Static/Utils/DictionaryHelpers.cs
Normal file
11
PkmnLib.Static/Utils/DictionaryHelpers.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace PkmnLib.Static.Utils;
|
||||
|
||||
public static class DictionaryHelpers
|
||||
{
|
||||
public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)
|
||||
{
|
||||
if (dictionary.TryGetValue(key, out var value))
|
||||
return value;
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user