Method Window
View SourceWindow<TSource>(IAsyncEnumerable<TSource>, int)
Processes a sequence into a series of subsequences representing a windowed subset of the original
Declaration
public static IAsyncEnumerable<IList<TSource>> Window<TSource>(this IAsyncEnumerable<TSource> source, int size)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The sequence to evaluate a sliding window over |
int | size | The size (number of elements) in each window |
Returns
Type | Description |
---|---|
IAsyncEnumerable<IList<TSource>> | A series of sequences representing each sliding window subsequence |
Type Parameters
Name | Description |
---|---|
TSource | The type of the elements of the source sequence |
Remarks
The number of sequences returned is: Max(0,
source
.Count() - size
+ 1)
Returned subsequences are buffered, but the overall operation is streamed.