I have a 24 hour "sliding window" sequence of "start" and "stop" events in memory comming from an iOT device.
I'm only interrested in finding "stop" events followed by "start" events in order to determine that the object is offline between these two events.
If I only have a start event, the device is considered offline before and online after.
If I only have a stop event, the device is considered online before and offline after.
This seems a standard pattern in programing but I can't figure a clever way to do that properly given the tools at my disposal, such as LINQ for instance.
What would be the best way to achieve this goal?
EDIT: I'd like to get a list of tuples of "stop" and "start" objects as a result.