WindowExtensionWindowTSource Method
Processes a sequence into a series of sub-sequences representing a windowed subset of
the original.
Namespace: MoreLinq.ExtensionsAssembly: MoreLinq (in MoreLinq.dll) Version: 3.4.0+b99a6a8cc504caf2d48372fe54a2f8116c59cd0c
public static IEnumerable<IList<TSource>> Window<TSource>(
this IEnumerable<TSource> source,
int size
)
<ExtensionAttribute>
Public Shared Function Window(Of TSource) (
source As IEnumerable(Of TSource),
size As Integer
) As IEnumerable(Of IList(Of TSource))
public:
[ExtensionAttribute]
generic<typename TSource>
static IEnumerable<IList<TSource>^>^ Window(
IEnumerable<TSource>^ source,
int size
)
[<ExtensionAttribute>]
static member Window :
source : IEnumerable<'TSource> *
size : int -> IEnumerable<IList<'TSource>>
- source IEnumerableTSource
- The sequence to evaluate a sliding window over.
- size Int32
- The size (number of elements) in each window.
- TSource
- The type of the elements of the source sequence.
IEnumerableIListTSource
A series of sequences representing each sliding window subsequence.In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
The number of sequences returned is: Max(0, sequence.Count() - windowSize) +
1
Returned sub-sequences are buffered, but the overall operation is streamed.