消除部分warning

This commit is contained in:
2023-05-16 15:21:04 +08:00
parent e7e2cea7bd
commit 67d599dce6
17 changed files with 396 additions and 54 deletions

View File

@@ -16,7 +16,7 @@ public static class DictionaryExtensions
/// <param name="dictionary">要操作的字典.</param>
/// <param name="key">指定键名.</param>
/// <returns>获取到的值.</returns>
public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
public static TValue? GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
{
return dictionary.TryGetValue(key, out TValue value) ? value : default(TValue);
}