Browse Source

Fix NETCORE to NET8(or newer) directive

pull/3195/head
Christoph Wille 1 year ago
parent
commit
b1a4ab15c4
  1. 2
      ICSharpCode.Decompiler/Util/BitOperations.cs
  2. 10
      ICSharpCode.Decompiler/Util/CollectionExtensions.cs
  3. 3
      ICSharpCode.Decompiler/Util/KeyComparer.cs

2
ICSharpCode.Decompiler/Util/BitOperations.cs

@ -2,7 +2,7 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
#if !NETCORE #if !NET8_0_OR_GREATER
namespace System.Numerics namespace System.Numerics
{ {
internal static class BitOperations internal static class BitOperations

10
ICSharpCode.Decompiler/Util/CollectionExtensions.cs

@ -14,7 +14,7 @@ namespace ICSharpCode.Decompiler.Util
value = pair.Value; value = pair.Value;
} }
#if !NETCORE #if !NET8_0_OR_GREATER
public static IEnumerable<(A, B)> Zip<A, B>(this IEnumerable<A> input1, IEnumerable<B> input2) public static IEnumerable<(A, B)> Zip<A, B>(this IEnumerable<A> input1, IEnumerable<B> input2)
{ {
return input1.Zip(input2, (a, b) => (a, b)); 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<T> ToHashSet<T>(this IEnumerable<T> input) public static HashSet<T> ToHashSet<T>(this IEnumerable<T> input)
{ {
return new HashSet<T>(input); return new HashSet<T>(input);
@ -312,6 +312,8 @@ namespace ICSharpCode.Decompiler.Util
} }
} }
#if !NET8_0_OR_GREATER
/// <summary> /// <summary>
/// Returns the maximum element. /// Returns the maximum element.
/// </summary> /// </summary>
@ -320,7 +322,7 @@ namespace ICSharpCode.Decompiler.Util
{ {
return source.MaxBy(keySelector, Comparer<K>.Default); return source.MaxBy(keySelector, Comparer<K>.Default);
} }
#endif
/// <summary> /// <summary>
/// Returns the maximum element. /// Returns the maximum element.
/// </summary> /// </summary>
@ -377,7 +379,7 @@ namespace ICSharpCode.Decompiler.Util
return first; return first;
} }
#if !NETCORE #if !NET8_0_OR_GREATER
public static int EnsureCapacity<T>(this List<T> list, int capacity) public static int EnsureCapacity<T>(this List<T> list, int capacity)
{ {
if (capacity < 0) if (capacity < 0)

3
ICSharpCode.Decompiler/Util/KeyComparer.cs

@ -81,7 +81,8 @@ namespace ICSharpCode.Decompiler.Util
public int GetHashCode(TElement obj) public int GetHashCode(TElement obj)
{ {
return keyEqualityComparer.GetHashCode(keySelector(obj)); var key = keySelector(obj)!;
return keyEqualityComparer.GetHashCode(key);
} }
} }
} }

Loading…
Cancel
Save