c# - linq group by contiguous blocks -
let's have next data:
time status 10:00 on 11:00 off 12:00 off 13:00 off 14:00 off 15:00 on 16:00 on
how grouping using linq like
[on, [10:00]], [off, [11:00, 12:00, 13:00, 14:00]], [on, [15:00, 16:00]]
create groupadjacent
extension, such 1 listed here.
and it's simple as:
var groups = mydata.groupadjacent(data => data.onoffstatus);
c# linq
No comments:
Post a Comment