refactor: Remove nullability constraint in GetValueOrDefault

This commit is contained in:
John Colvin committed 2024-01-13 12:56:30 -05:00
1 parent 2e12a37cb0
commit 8c8a8a9c22
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));
}