Friday, April 08, 2011

Stream to IEnumerable; IEnumerable to chunked IEnumerable

I may have missed these in F#, and they don't seem at all obvious in C# standard libraries. A couple of handy functions/extension methods with simple tests using the Should.Fluent assertion library.

In F#:

In C#:

2 comments :

Anonymous said...

If chunk is immutable won't window return the same array forever?

Steve Gilham said...

If you're wanting to use Window() in a more generalized form than just reading constant sized slabs off stateful enumerations like streams, the C# version you need is in the follow-up post.