linq group by contiguous blocks

Create a GroupAdjacent extension, such as the one listed here.

And then it’s as simple as:

var groups = myData.GroupAdjacent(data => data.OnOffStatus);

Leave a Comment