From 23f8c332b83a793efe679ee743acc401f4c7e1cc Mon Sep 17 00:00:00 2001 From: Leandro Fernandes Vieira Date: Sat, 12 Jun 2021 21:52:57 -0300 Subject: [PATCH] Revert "add bug: reuse same array; no test fails" This reverts commit 2977c3b782bac9e31f0689abd1b2e9bd3edf9bbf. --- MoreLinq/Batch.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MoreLinq/Batch.cs b/MoreLinq/Batch.cs index 11187c14b..4621f46cf 100644 --- a/MoreLinq/Batch.cs +++ b/MoreLinq/Batch.cs @@ -125,7 +125,7 @@ public static IEnumerable Batch(this IEnumerable Batch(int size) { - TSource[]? bucket = new TSource[size]; + TSource[]? bucket = null; var count = 0; foreach (var item in source) @@ -139,6 +139,7 @@ IEnumerable Batch(int size) yield return resultSelector(bucket); + bucket = null; count = 0; }