Is there an equivalent to the F# Seq.windowed in C#?

c#, f#, linq, window-functions

Solution

You can always just call `SeqModule.Windowed` from C#, you just need to reference `FSharp.Core.Dll`. The function names are also slightly mangled, so you call `Windowed` rather than `windowed`, so that it fits with the C# capitalisation conventions

Problem

I am working on some C# code dealing with problems like moving averages, where I often need to take a List / IEnumerable and work on chunks of consecutive data. The F# Seq module has a great function, windowed, which taking in a Sequence, returns a sequence of chunks of consecutive elements. Does C# have an equivalent function out-of-the-box with LINQ?

Original source