diff --git a/ICSharpCode.Decompiler/Util/BitOperations.cs b/ICSharpCode.Decompiler/Util/BitOperations.cs
index d8d8934f5..c5790f25b 100644
--- a/ICSharpCode.Decompiler/Util/BitOperations.cs
+++ b/ICSharpCode.Decompiler/Util/BitOperations.cs
@@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-#if !NETCORE
+#if !NET8_0_OR_GREATER
namespace System.Numerics
{
internal static class BitOperations
diff --git a/ICSharpCode.Decompiler/Util/CollectionExtensions.cs b/ICSharpCode.Decompiler/Util/CollectionExtensions.cs
index 2912707ec..0d5febe9c 100644
--- a/ICSharpCode.Decompiler/Util/CollectionExtensions.cs
+++ b/ICSharpCode.Decompiler/Util/CollectionExtensions.cs
@@ -14,7 +14,7 @@ namespace ICSharpCode.Decompiler.Util
value = pair.Value;
}
-#if !NETCORE
+#if !NET8_0_OR_GREATER
public static IEnumerable<(A, B)> Zip(this IEnumerable input1, IEnumerable input2)
{
return input1.Zip(input2, (a, b) => (a, b));
@@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.Util
}
}
-#if !NETCORE
+#if !NET8_0_OR_GREATER
public static HashSet ToHashSet(this IEnumerable input)
{
return new HashSet(input);
@@ -312,6 +312,8 @@ namespace ICSharpCode.Decompiler.Util
}
}
+
+#if !NET8_0_OR_GREATER
///
/// Returns the maximum element.
///
@@ -320,7 +322,7 @@ namespace ICSharpCode.Decompiler.Util
{
return source.MaxBy(keySelector, Comparer.Default);
}
-
+#endif
///
/// Returns the maximum element.
///
@@ -377,7 +379,7 @@ namespace ICSharpCode.Decompiler.Util
return first;
}
-#if !NETCORE
+#if !NET8_0_OR_GREATER
public static int EnsureCapacity(this List list, int capacity)
{
if (capacity < 0)
diff --git a/ICSharpCode.Decompiler/Util/KeyComparer.cs b/ICSharpCode.Decompiler/Util/KeyComparer.cs
index afb6cdcaa..d21fde548 100644
--- a/ICSharpCode.Decompiler/Util/KeyComparer.cs
+++ b/ICSharpCode.Decompiler/Util/KeyComparer.cs
@@ -81,7 +81,8 @@ namespace ICSharpCode.Decompiler.Util
public int GetHashCode(TElement obj)
{
- return keyEqualityComparer.GetHashCode(keySelector(obj));
+ var key = keySelector(obj)!;
+ return keyEqualityComparer.GetHashCode(key);
}
}
}