I have a c# class named Slot
which only accept values from 0:00:00
to 1.00:00:00
for all its TimeSpan
properties.
public class Slot
{
public TimeSpan StartTime { get; set; }
public TimeSpan EndTime { get; set; }
}
I have these values as my active Intervals which don't overlap each other:
var activeIntervals= new List<Slot>
{
new Slot
{
StartTime = new TimeSpan(10,0,0),
EndTime = new TimeSpan(12,0,0),
},
new Slot
{
StartTime = new TimeSpan(12,0,0),
EndTime = new TimeSpan(13,0,0),
},
new Slot
{
StartTime = new TimeSpan(16,0,0),
EndTime = new TimeSpan(22,0,0),
}
};
Is there any logic to get the other intervals of the day as inactiveIntervals?
In this case i want this result:
0:00:00
to 10:00:00
, 13:00:00
to 16:00:00
and 22:00:00
to 1.00:00:00