Skip to content

Commit 69b6ea2

Browse files
committed
multi-target net8 for LTS
1 parent cc208be commit 69b6ea2

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

OpenSkillSharp/OpenSkillSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
54
<ImplicitUsings>enable</ImplicitUsings>
65
<Nullable>enable</Nullable>
76
<Title>OpenSkillSharp</Title>
@@ -14,6 +13,7 @@
1413
<RepositoryType>git</RepositoryType>
1514
<PackageTags>ranking, rating, elo, trueskill, openskill, bayesian</PackageTags>
1615
<Copyright>Copyright (c) 2025 Patrick Lacni</Copyright>
16+
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
1717
</PropertyGroup>
1818

1919
<ItemGroup>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#if !NET9_0_OR_GREATER
2+
// ReSharper disable once CheckNamespace
3+
namespace System.Linq;
4+
5+
internal static class EnumerableIndexPolyfill
6+
{
7+
/// <summary>Returns an enumerable that incorporates the element's index into a tuple.</summary>
8+
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
9+
/// <param name="source">The source enumerable providing the elements.</param>
10+
/// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception>
11+
public static IEnumerable<(int Index, TSource Item)> Index<TSource>(this IEnumerable<TSource> source)
12+
{
13+
ArgumentNullException.ThrowIfNull(source);
14+
15+
int index = -1;
16+
17+
foreach (TSource element in source)
18+
{
19+
index++;
20+
yield return (index, element);
21+
}
22+
}
23+
}
24+
25+
#endif

0 commit comments

Comments
 (0)