diff --git a/.github/workflows/CodeCoverage.yml b/.github/workflows/CodeCoverage.yml
index 29ab797..5c0d8de 100644
--- a/.github/workflows/CodeCoverage.yml
+++ b/.github/workflows/CodeCoverage.yml
@@ -17,10 +17,10 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
- dotnet-version: '8.0.x'
+ dotnet-version: '9.0.x'
- name: Collect coverage
- run: dotnet test source -c Release -f net8.0
+ run: dotnet test source -c Release -f net9.0
env:
CollectCoverage: true
CoverletOutputFormat: lcov
@@ -30,4 +30,4 @@ jobs:
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- path-to-lcov: 'build\lcov.net8.0.info'
+ path-to-lcov: 'build\lcov.net9.0.info'
diff --git a/.github/workflows/ContinuousIntegration.yml b/.github/workflows/ContinuousIntegration.yml
index 0f88dfd..6dad865 100644
--- a/.github/workflows/ContinuousIntegration.yml
+++ b/.github/workflows/ContinuousIntegration.yml
@@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
- dotnet-version: '8.0.x'
+ dotnet-version: '9.0.x'
source-url: https://nuget.pkg.github.com/Doraku/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -30,8 +30,8 @@ jobs:
- name: Run tests net48
run: dotnet test source -c Release -f net48 --no-build
- - name: Run tests net8.0
- run: dotnet test source -c Release -f net8.0 --no-build
+ - name: Run tests net9.0
+ run: dotnet test source -c Release -f net9.0 --no-build
- name: Decrypte snk file
env:
diff --git a/.github/workflows/PullRequest.yml b/.github/workflows/PullRequest.yml
index 025ef4f..eac8c70 100644
--- a/.github/workflows/PullRequest.yml
+++ b/.github/workflows/PullRequest.yml
@@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
- dotnet-version: '8.0.x'
+ dotnet-version: '9.0.x'
- name: Build
run: dotnet build source -c Release -p:TreatWarningsAsErrors=true
@@ -24,5 +24,5 @@ jobs:
- name: Run tests net48
run: dotnet test source -c Release -f net48 --no-build
- - name: Run tests net8.0
- run: dotnet test source -c Release -f net8.0 --no-build
\ No newline at end of file
+ - name: Run tests net9.0
+ run: dotnet test source -c Release -f net9.0 --no-build
\ No newline at end of file
diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml
index 398a0b2..5d72c0c 100644
--- a/.github/workflows/Release.yml
+++ b/.github/workflows/Release.yml
@@ -12,7 +12,7 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
- dotnet-version: '8.0.x'
+ dotnet-version: '9.0.x'
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
diff --git a/documentation/NEXT_RELEASENOTES.txt b/documentation/NEXT_RELEASENOTES.txt
index e69de29..3821003 100644
--- a/documentation/NEXT_RELEASENOTES.txt
+++ b/documentation/NEXT_RELEASENOTES.txt
@@ -0,0 +1 @@
+- added net9.0
\ No newline at end of file
diff --git a/source/DefaultUnDo.Test/DefaultUnDo.Test.csproj b/source/DefaultUnDo.Test/DefaultUnDo.Test.csproj
index d016f16..0082ebd 100644
--- a/source/DefaultUnDo.Test/DefaultUnDo.Test.csproj
+++ b/source/DefaultUnDo.Test/DefaultUnDo.Test.csproj
@@ -5,7 +5,7 @@
net462;
net48;
- net8.0;
+ net9.0;
DefaultUnDo
@@ -20,7 +20,8 @@
-
+
+
diff --git a/source/DefaultUnDo.Test/GroupUnDoTests/ConstructorShould.cs b/source/DefaultUnDo.Test/GroupUnDoTests/ConstructorShould.cs
index 280d570..91a71d5 100644
--- a/source/DefaultUnDo.Test/GroupUnDoTests/ConstructorShould.cs
+++ b/source/DefaultUnDo.Test/GroupUnDoTests/ConstructorShould.cs
@@ -6,15 +6,6 @@ namespace DefaultUnDo.GroupUnDoTests;
public sealed class ConstructorShould
{
- [Fact]
- public void ThrowArgumentNullExceptionWhenCommandsIsNull()
- {
- Check
- .ThatCode(() => new GroupUnDo(default))
- .Throws()
- .WithProperty("ParamName", "commands");
- }
-
[Fact]
public void ThrowArgumentNullExceptionWhenCommandsEmpty()
{
diff --git a/source/DefaultUnDo/DefaultUnDo.csproj b/source/DefaultUnDo/DefaultUnDo.csproj
index 738e1af..42d6acc 100644
--- a/source/DefaultUnDo/DefaultUnDo.csproj
+++ b/source/DefaultUnDo/DefaultUnDo.csproj
@@ -6,6 +6,7 @@
netstandard2.0;
netstandard2.1;
net8.0;
+ net9.0;
enable
@@ -16,8 +17,9 @@
-
+
+
\ No newline at end of file
diff --git a/source/DefaultUnDo/GroupUnDo.cs b/source/DefaultUnDo/GroupUnDo.cs
index 7b8a804..4f0d837 100644
--- a/source/DefaultUnDo/GroupUnDo.cs
+++ b/source/DefaultUnDo/GroupUnDo.cs
@@ -31,24 +31,21 @@ public sealed class GroupUnDo : IMergeableUnDo
///
/// The description of this
/// The sequence of contained by the instance.
- /// is null.
/// contains null elements.
- public GroupUnDo(object? description, params IUnDo[] commands)
+ public GroupUnDo(object? description, params ReadOnlySpan commands)
{
- ArgumentNullException.ThrowIfNull(commands);
-
- _description = description;
- _commands = commands;
-
- if (_commands.Length is 0)
+ if (commands.Length is 0)
{
throw new ArgumentException("IUnDo sequence contains no elements.", nameof(commands));
}
- if (_commands.Any(i => i is null))
+ if (commands.Any(i => i is null))
{
throw new ArgumentException("IUnDo sequence contains null elements.", nameof(commands));
}
+
+ _description = description;
+ _commands = [.. commands];
}
///
@@ -57,7 +54,7 @@ public GroupUnDo(object? description, params IUnDo[] commands)
/// The sequence of contained by the instance.
/// is null.
/// contains null elements.
- public GroupUnDo(params IUnDo[] commands)
+ public GroupUnDo(params ReadOnlySpan commands)
: this(null, commands)
{ }
diff --git a/source/DefaultUnDo/Internal/Extensions/ReadOnlySpanExtensions.cs b/source/DefaultUnDo/Internal/Extensions/ReadOnlySpanExtensions.cs
new file mode 100644
index 0000000..670ca61
--- /dev/null
+++ b/source/DefaultUnDo/Internal/Extensions/ReadOnlySpanExtensions.cs
@@ -0,0 +1,17 @@
+namespace System;
+
+internal static class ReadOnlySpanExtensions
+{
+ public static bool Any(this ReadOnlySpan source, Predicate predicate)
+ {
+ foreach (ref readonly T item in source)
+ {
+ if (predicate(item))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/source/Directory.Build.props b/source/Directory.Build.props
index a8a284c..313ba00 100644
--- a/source/Directory.Build.props
+++ b/source/Directory.Build.props
@@ -20,7 +20,7 @@
-
+