Add all missing docs

This commit is contained in:
Deukhoofd committed 2025-05-03 14:18:12 +02:00
1 parent 4d5dfd0342
commit 441f5dddaf
40 files changed
+400 -21

No files matched your search

+8 -6
View File
@@ -1,12 +1,14 @@
namespace PkmnLib.Static.Utils;
/// <summary>
/// Helpers for working with dictionaries.
/// </summary>
public static class DictionaryHelpers
{
/// <summary>
/// Gets the value for a key in a dictionary, or returns a default value if the key is not found.
/// </summary>
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;
}
TValue defaultValue) =>
dictionary.TryGetValue(key, out var value) ? value : defaultValue;
}