Skip to content

Commit dbfc8da

Browse files
authored
Merge pull request #3 from myssto/multi-target-build
Multi target `net9.0;net8.0` for LTS support
2 parents b471f16 + 4f1b1eb commit dbfc8da

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

OpenSkillSharp.Tests/Models/PlackettLuceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void Rate_Balance()
153153
[Fact]
154154
public void Rate_AllScoresTied()
155155
{
156-
PlackettLuce model = new PlackettLuce { Mu = 30, Sigma = 30.0 / 3 };
156+
PlackettLuce model = new() { Mu = 30, Sigma = 30.0 / 3 };
157157

158158
ITeam[] teams = [new Team { Players = [model.Rating()] }, new Team { Players = [model.Rating()] }];
159159
ITeam[] result = model.Rate(teams, scores: [0, 0]).ToArray();

OpenSkillSharp.Tests/OpenSkillSharp.Tests.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

OpenSkillSharp/OpenSkillSharp.csproj

Lines changed: 7 additions & 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>
@@ -25,4 +25,10 @@
2525
<PackageReference Include="MathNet.Numerics" Version="5.0.0"/>
2626
</ItemGroup>
2727

28+
<ItemGroup>
29+
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
30+
<_Parameter1>$(MSBuildProjectName).Tests</_Parameter1>
31+
</AssemblyAttribute>
32+
</ItemGroup>
33+
2834
</Project>
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 EnumerablePolyfills
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)