-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch
should return IEnumerable<T[]>
#98
Comments
Or at least Reported by @Arithmomaniac on 2015-05-27 13:54:17 |
This looks reasonable to me (after all the length is known beforehand). However, if done it should be done for 2.0, or else for the next major version as that signature change would break the ABI. |
I would argue that even returning a sequence of arrays might be best here, which is required, could then be cast to an |
Every batch will be the same size except the last one if the source sequence doesn't have a total count of elements that's a multiple of the requested size.
This is almost the case with most LINQ operators yet they don't return
The signature of |
Considering that all but potentially the last batch will have the same size, I think it's fair to return a sequence of arrays. The signature will also be aligned with |
Batch
should IEnumerable<T[]>
Batch
should IEnumerable<T[]>
Batch
should return IEnumerable<T[]>
This is a squashed merge or PR morelinq#1014 that closes morelinq#98.
Since batches are about splitting an
IEnumerable
into fixed sizes, every batch should know how many items it has, in addition to the original order of the source enumerable. Size + order preservation =IList
.This should break little (if any) existing code, because
IList
inheritsIEnumerable
. Asides from the signature, the only code change that needs to be made is for the underlying bucket store to be aList
instead of anArray
(which is the more LINQy approach anyways).Originally reported on Google Code with ID 98
Reported by @Arithmomaniac on 2015-03-09 14:19:50
The text was updated successfully, but these errors were encountered: