fix ToDictionary extension

fixes a9bfd96027
This commit is contained in:
Morilli 2025-02-14 19:07:51 +01:00
parent 5d6b35e2c9
commit 283ed40f33
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,8 @@
using System.Collections.Generic;
using System.IO;
#if NET8_0_OR_GREATER
using System.Linq;
#endif
using BizHawk.Common.CollectionExtensions;

View File

@ -302,9 +302,11 @@ namespace BizHawk.Common.CollectionExtensions
return str.Substring(startIndex: offset, length: length);
}
#if !NET8_0_OR_GREATER
/// <summary>shallow clone</summary>
public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> list)
public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> list) where TKey : notnull
=> list.ToDictionary(static kvp => kvp.Key, static kvp => kvp.Value);
#endif
public static bool IsSortedAsc<T>(this IReadOnlyList<T> list)
where T : IComparable<T>