We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 973029d commit 4774298Copy full SHA for 4774298
1 file changed
src/Codebreaker.ViewModels/Extensions/DictionaryExtensions.cs
@@ -0,0 +1,7 @@
1
+namespace System.Collections.Generic;
2
+
3
+internal static class DictionaryExtensions
4
+{
5
+ public static TValue? GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue? defaultValue = default) =>
6
+ dictionary.TryGetValue(key, out var value) ? value : defaultValue;
7
+}
0 commit comments