Revert "Add more `GetValueOrDefault` overloads"

This reverts commit 34d71e90bc.

This was hardly used and caused trouble in .net 8 with the way it was defined.
This commit is contained in:
Morilli 2025-02-14 18:48:10 +01:00
parent 426c743da9
commit f12f90366b
1 changed files with 0 additions and 8 deletions

View File

@ -165,10 +165,6 @@ namespace BizHawk.Common.CollectionExtensions
/// If the key is not present, returns default(TValue).
/// backported from .NET Core 2.0
/// </summary>
public static TValue? GetValueOrDefault<TKey, TValue>(IDictionary<TKey, TValue> dictionary, TKey key)
=> dictionary.TryGetValue(key, out var found) ? found : default;
/// <inheritdoc cref="GetValueOrDefault{K,V}(IDictionary{K,V},K)"/>
public static TValue? GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
=> dictionary.TryGetValue(key, out var found) ? found : default;
@ -177,10 +173,6 @@ namespace BizHawk.Common.CollectionExtensions
/// If the key is not present, returns <paramref name="defaultValue"/>.
/// backported from .NET Core 2.0
/// </summary>
public static TValue? GetValueOrDefault<TKey, TValue>(IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)
=> dictionary.TryGetValue(key, out var found) ? found : defaultValue;
/// <inheritdoc cref="GetValueOrDefault{K,V}(IDictionary{K,V},K,V)"/>
public static TValue? GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)
=> dictionary.TryGetValue(key, out var found) ? found : defaultValue;
#endif