Skip to content

Commit 971836d

Browse files
Merge pull request #3195 from icsharpcode/fix/net80directives
Fix NETCORE to NET8(or newer) directive
2 parents 1971f69 + b1a4ab1 commit 971836d

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

ICSharpCode.Decompiler/Util/BitOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Runtime.CompilerServices;
33
using System.Runtime.InteropServices;
44

5-
#if !NETCORE
5+
#if !NET8_0_OR_GREATER
66
namespace System.Numerics
77
{
88
internal static class BitOperations

ICSharpCode.Decompiler/Util/CollectionExtensions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static void Deconstruct<K, V>(this KeyValuePair<K, V> pair, out K key, ou
1414
value = pair.Value;
1515
}
1616

17-
#if !NETCORE
17+
#if !NET8_0_OR_GREATER
1818
public static IEnumerable<(A, B)> Zip<A, B>(this IEnumerable<A> input1, IEnumerable<B> input2)
1919
{
2020
return input1.Zip(input2, (a, b) => (a, b));
@@ -66,7 +66,7 @@ public static IEnumerable<T> Slice<T>(this IReadOnlyList<T> input, int offset)
6666
}
6767
}
6868

69-
#if !NETCORE
69+
#if !NET8_0_OR_GREATER
7070
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> input)
7171
{
7272
return new HashSet<T>(input);
@@ -312,6 +312,8 @@ public static T MinBy<T, K>(this IEnumerable<T> source, Func<T, K> keySelector,
312312
}
313313
}
314314

315+
316+
#if !NET8_0_OR_GREATER
315317
/// <summary>
316318
/// Returns the maximum element.
317319
/// </summary>
@@ -320,7 +322,7 @@ public static T MaxBy<T, K>(this IEnumerable<T> source, Func<T, K> keySelector)
320322
{
321323
return source.MaxBy(keySelector, Comparer<K>.Default);
322324
}
323-
325+
#endif
324326
/// <summary>
325327
/// Returns the maximum element.
326328
/// </summary>
@@ -377,7 +379,7 @@ public static void RemoveLast<T>(this IList<T> list)
377379
return first;
378380
}
379381

380-
#if !NETCORE
382+
#if !NET8_0_OR_GREATER
381383
public static int EnsureCapacity<T>(this List<T> list, int capacity)
382384
{
383385
if (capacity < 0)

ICSharpCode.Decompiler/Util/KeyComparer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public bool Equals(TElement? x, TElement? y)
8181

8282
public int GetHashCode(TElement obj)
8383
{
84-
return keyEqualityComparer.GetHashCode(keySelector(obj));
84+
var key = keySelector(obj)!;
85+
return keyEqualityComparer.GetHashCode(key);
8586
}
8687
}
8788
}

0 commit comments

Comments
 (0)