diff --git a/MoreLinq.Test/BatchTest.cs b/MoreLinq.Test/BatchTest.cs index bd2db7127..ee10acfb2 100644 --- a/MoreLinq.Test/BatchTest.cs +++ b/MoreLinq.Test/BatchTest.cs @@ -62,17 +62,6 @@ public void BatchSequenceTransformingResult() result.AssertSequenceEqual(10, 26, 9); } - [Test] - public void BatchSequenceYieldsListsOfBatches() - { - var result = new[] { 1, 2, 3 }.Batch(2); - - using var reader = result.Read(); - Assert.That(reader.Read(), Is.InstanceOf(typeof(IList))); - Assert.That(reader.Read(), Is.InstanceOf(typeof(IList))); - reader.ReadEnd(); - } - [Test] public void BatchSequencesAreIndependentInstances() { diff --git a/MoreLinq/Batch.cs b/MoreLinq/Batch.cs index b8abf7f1e..5da60c07a 100644 --- a/MoreLinq/Batch.cs +++ b/MoreLinq/Batch.cs @@ -47,7 +47,7 @@ static partial class MoreEnumerable /// /// - public static IEnumerable> Batch(this IEnumerable source, int size) + public static IEnumerable Batch(this IEnumerable source, int size) { return Batch(source, size, IdFn); } @@ -80,7 +80,7 @@ public static IEnumerable> Batch(this IEnumerable< /// public static IEnumerable Batch(this IEnumerable source, int size, - Func, TResult> resultSelector) + Func resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (size <= 0) throw new ArgumentOutOfRangeException(nameof(size)); diff --git a/MoreLinq/CompatibilitySuppressions.xml b/MoreLinq/CompatibilitySuppressions.xml index 227399b89..689b85169 100644 --- a/MoreLinq/CompatibilitySuppressions.xml +++ b/MoreLinq/CompatibilitySuppressions.xml @@ -57,6 +57,13 @@ lib/netstandard2.1/MoreLinq.dll true + + CP0002 + M:MoreLinq.Extensions.BatchExtension.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/net462/MoreLinq.dll + lib/netstandard2.0/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Append``1(System.Collections.Generic.IEnumerable{``0},``0) @@ -64,6 +71,13 @@ lib/netstandard2.0/MoreLinq.dll true + + CP0002 + M:MoreLinq.MoreEnumerable.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/net462/MoreLinq.dll + lib/netstandard2.0/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Concat``1(System.Collections.Generic.IEnumerable{``0},``0) @@ -78,6 +92,13 @@ lib/netstandard2.0/MoreLinq.dll true + + CP0002 + M:MoreLinq.Extensions.BatchExtension.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/net6.0/MoreLinq.dll + lib/net6.0/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Append``1(System.Collections.Generic.IEnumerable{``0},``0) @@ -85,6 +106,13 @@ lib/net6.0/MoreLinq.dll true + + CP0002 + M:MoreLinq.MoreEnumerable.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/net6.0/MoreLinq.dll + lib/net6.0/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Concat``1(System.Collections.Generic.IEnumerable{``0},``0) @@ -99,6 +127,13 @@ lib/net6.0/MoreLinq.dll true + + CP0002 + M:MoreLinq.Extensions.BatchExtension.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/netstandard2.0/MoreLinq.dll + lib/netstandard2.0/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Append``1(System.Collections.Generic.IEnumerable{``0},``0) @@ -106,6 +141,13 @@ lib/netstandard2.0/MoreLinq.dll true + + CP0002 + M:MoreLinq.MoreEnumerable.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/netstandard2.0/MoreLinq.dll + lib/netstandard2.0/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Concat``1(System.Collections.Generic.IEnumerable{``0},``0) @@ -120,6 +162,13 @@ lib/netstandard2.0/MoreLinq.dll true + + CP0002 + M:MoreLinq.Extensions.BatchExtension.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/netstandard2.1/MoreLinq.dll + lib/netstandard2.1/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Append``1(System.Collections.Generic.IEnumerable{``0},``0) @@ -127,6 +176,13 @@ lib/netstandard2.1/MoreLinq.dll true + + CP0002 + M:MoreLinq.MoreEnumerable.Batch``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{System.Collections.Generic.IEnumerable{``0},``1}) + lib/netstandard2.1/MoreLinq.dll + lib/netstandard2.1/MoreLinq.dll + true + CP0002 M:MoreLinq.MoreEnumerable.Concat``1(System.Collections.Generic.IEnumerable{``0},``0) diff --git a/MoreLinq/Extensions.g.cs b/MoreLinq/Extensions.g.cs index 34d2cdc9d..61814e2fb 100644 --- a/MoreLinq/Extensions.g.cs +++ b/MoreLinq/Extensions.g.cs @@ -680,7 +680,7 @@ public static partial class BatchExtension /// /// - public static IEnumerable> Batch(this IEnumerable source, int size) + public static IEnumerable Batch(this IEnumerable source, int size) => MoreEnumerable.Batch(source, size); /// @@ -711,7 +711,7 @@ public static IEnumerable> Batch(this IEnumerable< /// public static IEnumerable Batch(this IEnumerable source, int size, - Func, TResult> resultSelector) + Func resultSelector) => MoreEnumerable.Batch(source, size, resultSelector); } diff --git a/MoreLinq/PublicAPI/net6.0/PublicAPI.Unshipped.txt b/MoreLinq/PublicAPI/net6.0/PublicAPI.Unshipped.txt index c69af7a11..bef3363b2 100644 --- a/MoreLinq/PublicAPI/net6.0/PublicAPI.Unshipped.txt +++ b/MoreLinq/PublicAPI/net6.0/PublicAPI.Unshipped.txt @@ -1,5 +1,9 @@ #nullable enable +*REMOVED*static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func!, TResult>! resultSelector) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable!>! *REMOVED*static MoreLinq.MoreEnumerable.Append(this System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func!, TResult>! resultSelector) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable!>! *REMOVED*static MoreLinq.MoreEnumerable.Concat(this System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.Prepend(this System.Collections.Generic.IEnumerable! source, TSource value) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.DistinctBy(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector) -> System.Collections.Generic.IEnumerable! @@ -8,7 +12,11 @@ *REMOVED*static MoreLinq.MoreEnumerable.TakeLast(this System.Collections.Generic.IEnumerable! source, int count) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.ToHashSet(this System.Collections.Generic.IEnumerable! source) -> System.Collections.Generic.HashSet! *REMOVED*static MoreLinq.MoreEnumerable.ToHashSet(this System.Collections.Generic.IEnumerable! source, System.Collections.Generic.IEqualityComparer? comparer) -> System.Collections.Generic.HashSet! +static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func! resultSelector) -> System.Collections.Generic.IEnumerable! +static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.Append(System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! +static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func! resultSelector) -> System.Collections.Generic.IEnumerable! +static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.DistinctBy(System.Collections.Generic.IEnumerable! source, System.Func! keySelector) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.DistinctBy(System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Collections.Generic.IEqualityComparer? comparer) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.Prepend(System.Collections.Generic.IEnumerable! source, TSource value) -> System.Collections.Generic.IEnumerable! diff --git a/MoreLinq/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/MoreLinq/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt index 7b97d25d3..08aae18e5 100644 --- a/MoreLinq/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt +++ b/MoreLinq/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt @@ -1,8 +1,16 @@ #nullable enable +*REMOVED*static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func!, TResult>! resultSelector) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable!>! *REMOVED*static MoreLinq.MoreEnumerable.Append(this System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func!, TResult>! resultSelector) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable!>! *REMOVED*static MoreLinq.MoreEnumerable.Concat(this System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.Prepend(this System.Collections.Generic.IEnumerable! source, TSource value) -> System.Collections.Generic.IEnumerable! +static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func! resultSelector) -> System.Collections.Generic.IEnumerable! +static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.Append(System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! +static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func! resultSelector) -> System.Collections.Generic.IEnumerable! +static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.Prepend(System.Collections.Generic.IEnumerable! source, TSource value) -> System.Collections.Generic.IEnumerable! MoreLinq.Extensions.HasDuplicatesExtension static MoreLinq.Extensions.HasDuplicatesExtension.HasDuplicates(this System.Collections.Generic.IEnumerable! source) -> bool diff --git a/MoreLinq/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt b/MoreLinq/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt index 85afd9b54..837418fdd 100644 --- a/MoreLinq/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt +++ b/MoreLinq/PublicAPI/netstandard2.1/PublicAPI.Unshipped.txt @@ -1,12 +1,20 @@ #nullable enable +*REMOVED*static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func!, TResult>! resultSelector) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable!>! *REMOVED*static MoreLinq.MoreEnumerable.Append(this System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func!, TResult>! resultSelector) -> System.Collections.Generic.IEnumerable! +*REMOVED*static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable!>! *REMOVED*static MoreLinq.MoreEnumerable.Concat(this System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.Prepend(this System.Collections.Generic.IEnumerable! source, TSource value) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.SkipLast(this System.Collections.Generic.IEnumerable! source, int count) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.TakeLast(this System.Collections.Generic.IEnumerable! source, int count) -> System.Collections.Generic.IEnumerable! *REMOVED*static MoreLinq.MoreEnumerable.ToHashSet(this System.Collections.Generic.IEnumerable! source) -> System.Collections.Generic.HashSet! *REMOVED*static MoreLinq.MoreEnumerable.ToHashSet(this System.Collections.Generic.IEnumerable! source, System.Collections.Generic.IEqualityComparer? comparer) -> System.Collections.Generic.HashSet! +static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func! resultSelector) -> System.Collections.Generic.IEnumerable! +static MoreLinq.Extensions.BatchExtension.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.Append(System.Collections.Generic.IEnumerable! head, T tail) -> System.Collections.Generic.IEnumerable! +static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size, System.Func! resultSelector) -> System.Collections.Generic.IEnumerable! +static MoreLinq.MoreEnumerable.Batch(this System.Collections.Generic.IEnumerable! source, int size) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.Prepend(System.Collections.Generic.IEnumerable! source, TSource value) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.SkipLast(System.Collections.Generic.IEnumerable! source, int count) -> System.Collections.Generic.IEnumerable! static MoreLinq.MoreEnumerable.TakeLast(System.Collections.Generic.IEnumerable! source, int count) -> System.Collections.Generic.IEnumerable!