Exploring MoreLINQ Part 15 - Windowing
The fifteenth video in my Exploring MoreLINQ series looks at a powerful capability of MoreLINQ to view all items in a sequence with a sliding 'window'. So with a sequence of ABCDEFG
and a window size of 3, the first window would be ABC
, then BCD
, then CDE
all the way to EFG
.
MoreLINQ provides the Window
extension method to achieve this, but also WindowLeft
and WindowRight
that offer additional options about how the output sequence starts and stops.
Note that if you are using a window size of 2, there is another helpful MoreLINQ method called Pairwise
which we'll be discussing next in this series.
You can find all videos in this series here.
Want to learn more about LINQ? Be sure to check out my Pluralsight course LINQ Best Practices.