I have one List<T>, which is a mixture of "regular" elements and "marker" elements. I want to break it into List<List<T>>, broken into markers.
eg. given the input {a, b, M, c, d, e, f, M, g}, where 'M' is a marker element, I want to get {{a, b}, {c, d, e, f} , {g}}
It's easy to complete the task with a loop, but it seems like it should be possible to express it more compactly with LINQ, and after a little scratching my head, I just don't see how to do it. (I think LINQ-fu is not enough.)
source
share