The use of buffering on Repeat() and Cartesian() is currently commented as a TODO. The attached patch:
Implements a buffering class that buffers enumerables in memory.
Changes Repeat() and Cartesian to use this buffering.
Further changes Repeat() to skip this if the count is 0 or 1.
Defines an IBufferedEnumerable<T> interfaces, documented as adding a buffering guarantee to IEnumerable<T>.
Defines two overloads of a method to create such a buffered instance. One of which insists that buffering happen even if the source implements ICollection<T>. (Otherwise it is assumed that the source already serves as a buffer adequately).
In short: Deals with the two TODO items, and brings the advantage of the code needed to do so, to the user.
The use of buffering on
Repeat()
andCartesian()
is currently commented as a TODO. The attached patch:Repeat()
andCartesian
to use this buffering.Repeat()
to skip this if the count is 0 or 1.IBufferedEnumerable<T>
interfaces, documented as adding a buffering guarantee toIEnumerable<T>
.ICollection<T>
. (Otherwise it is assumed that the source already serves as a buffer adequately).In short: Deals with the two TODO items, and brings the advantage of the code needed to do so, to the user.
Originally reported on Google Code with ID 87
Reported by
jonhanna76.JH
on 2013-12-12 14:46:28