refactor: Remove nullability constraint in GetValueOrDefault

This commit is contained in:
John Colvin committed 2024-09-18 14:02:34 +00:00
1 parent 9e4af550f8
commit 89afbbd00a
1 file changed
+3 -1
@@ -1,6 +1,7 @@
using bts.collections;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace System.Collections.Generic {
@@ -122,7 +123,8 @@ namespace System.Collections.Generic {
}
#nullable enable
public static TValue? GetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue?>? dictionary, TKey key) where TKey : notnull {
[return: MaybeNull]
public static TValue GetValueOrDefault<TKey, TValue>(this Dictionary<TKey, TValue>? dictionary, TKey key) where TKey : notnull {
if (dictionary is null) {
throw new ArgumentNullException(nameof(dictionary));
}