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:
parent
426c743da9
commit
f12f90366b
|
@ -165,10 +165,6 @@ namespace BizHawk.Common.CollectionExtensions
|
||||||
/// If the key is not present, returns default(TValue).
|
/// If the key is not present, returns default(TValue).
|
||||||
/// backported from .NET Core 2.0
|
/// backported from .NET Core 2.0
|
||||||
/// </summary>
|
/// </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)
|
public static TValue? GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key)
|
||||||
=> dictionary.TryGetValue(key, out var found) ? found : default;
|
=> 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"/>.
|
/// If the key is not present, returns <paramref name="defaultValue"/>.
|
||||||
/// backported from .NET Core 2.0
|
/// backported from .NET Core 2.0
|
||||||
/// </summary>
|
/// </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)
|
public static TValue? GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)
|
||||||
=> dictionary.TryGetValue(key, out var found) ? found : defaultValue;
|
=> dictionary.TryGetValue(key, out var found) ? found : defaultValue;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue