Skip to content

Commit 3cd6b9b

Browse files
Simplify the loop
1 parent b5d9b6f commit 3cd6b9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Test/Notion.IntegrationTests/StreamSplitExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public static IEnumerable<Stream> Split(Stream inputStream, int numberOfParts)
2727
long baseSize = totalSize / numberOfParts;
2828
long remainder = totalSize % numberOfParts;
2929

30-
while (numberOfParts-- > 0)
30+
for (int i = 0; i < numberOfParts; i++)
3131
{
32-
long currentPartSize = numberOfParts == 0 ? baseSize + remainder : baseSize;
32+
long currentPartSize = i == numberOfParts - 1 ? baseSize + remainder : baseSize;
3333

3434
var partStream = new MemoryStream();
3535
CopyStream(buffer, partStream, currentPartSize);

0 commit comments

Comments
 (0)