diff --git a/MoreLinq.Test/SequenceTest.cs b/MoreLinq.Test/SequenceTest.cs index ad01a274d..4c75ff43f 100644 --- a/MoreLinq.Test/SequenceTest.cs +++ b/MoreLinq.Test/SequenceTest.cs @@ -110,8 +110,9 @@ public void SequenceWithDescendingRangeDescendigStep(int start, int stop, int st [TestCase(int.MinValue, int.MinValue, null)] public void SequenceWithStartEqualsStop(int start, int stop, int? step) { - var result = step.HasValue ? MoreEnumerable.Sequence(start, stop, step.Value) - : MoreEnumerable.Sequence(start, stop); + var result = step is { } someStep + ? MoreEnumerable.Sequence(start, stop, someStep) + : MoreEnumerable.Sequence(start, stop); Assert.That(start, Is.EqualTo(result.Single())); } diff --git a/MoreLinq.Test/ToDataTableTest.cs b/MoreLinq.Test/ToDataTableTest.cs index 9b4249d62..d6cac4cda 100644 --- a/MoreLinq.Test/ToDataTableTest.cs +++ b/MoreLinq.Test/ToDataTableTest.cs @@ -41,10 +41,8 @@ sealed class TestObject(int key) public override string ToString() => nameof(TestObject); } - readonly IReadOnlyCollection testObjects; - public ToDataTableTest() => this.testObjects = Enumerable.Range(0, 3) .Select(i => new TestObject(i)) @@ -172,16 +170,14 @@ public void ToDataTableWithSchema() Assert.That(rows.Select(r => r["Value"]).ToArray(), Is.EqualTo(vars.Select(e => e.Value).ToArray())); } - readonly struct Point + readonly struct Point(int x, int y) { - #pragma warning disable CA1805 // Do not initialize unnecessarily (avoids CS0649) public static Point Empty = new(); #pragma warning restore CA1805 // Do not initialize unnecessarily public bool IsEmpty => X == 0 && Y == 0; - public int X { get; } - public int Y { get; } - public Point(int x, int y) : this() { X = x; Y = y; } + public int X { get; } = x; + public int Y { get; } = y; } [Test] diff --git a/MoreLinq.Test/TraceTest.cs b/MoreLinq.Test/TraceTest.cs index 6e32ba55e..e0604a2cb 100644 --- a/MoreLinq.Test/TraceTest.cs +++ b/MoreLinq.Test/TraceTest.cs @@ -67,8 +67,8 @@ public void TraceSequenceWithFormatter() var trace = Lines(CaptureTrace(delegate { var formatter = CultureInfo.InvariantCulture; - new int?[] { 1234, null, 5678 }.Trace(n => n.HasValue - ? n.Value.ToString("N0", formatter) + new int?[] { 1234, null, 5678 }.Trace(n => n is { } some + ? some.ToString("N0", formatter) : "#NULL") .Consume(); })); diff --git a/MoreLinq/MoreLinq.csproj b/MoreLinq/MoreLinq.csproj index 38d48eee5..d21855c5e 100644 --- a/MoreLinq/MoreLinq.csproj +++ b/MoreLinq/MoreLinq.csproj @@ -119,7 +119,7 @@ $([System.Text.RegularExpressions.Regex]::Replace($(Copyright), `\s+`, ` `).Trim()) MoreLINQ en-US - 4.1.0 + 4.2.0 MoreLINQ Developers. netstandard2.0;netstandard2.1;net6.0;net8.0 portable @@ -136,7 +136,7 @@ ..\dist README.md true - 4.0.0 + 4.1.0 true true true