Avoid pre-allocating large arrays in some scenarios for Enumerable.Chunk (#67210)
authormadelson <1269046+madelson@users.noreply.github.com>
Mon, 4 Apr 2022 11:59:23 +0000 (07:59 -0400)
committerGitHub <noreply@github.com>
Mon, 4 Apr 2022 11:59:23 +0000 (12:59 +0100)
commitd9b8a0904187c533990cba681bb5defb57382a02
tree9f8169688a6acd70e5fd5ddb6055e66ba0314433
parentc830e33c1aa0526ceefead48e39c3d483e7732c9
Avoid pre-allocating large arrays in some scenarios for Enumerable.Chunk (#67210)

* Avoid pre-allocating large arrays in some scenarios for Enumerable.Chunk().

Fix #67132

* Switch Chunk() to use List-based implementation.

See discussion here:
https://github.com/dotnet/runtime/pull/67210#discussion_r836561697

* Address feedback from https://github.com/dotnet/runtime/pull/67210/files
src/libraries/System.Linq/src/System/Linq/Chunk.cs
src/libraries/System.Linq/tests/ChunkTests.cs