c# check if a timespan range is between timespan range and how many hours
Assuming I have 3 time ranges: 07:00 - 18:00 18:00 - 23:00 23:00 - 07:00 and the code: public class TimeShift { public TimeSpan Start { get; set; } public TimeSpan End { get; set; } } List<TimeShift> shifts = new List<TimeShift>(); How can I check if every item in the list is between the 3 ranges above and how many hours? For example one TimeShift where: Start: 07:00 End: 23:30 then that means 16.5 hours. For the examples above: Range 1: 11 hours Range 2: 5 hours Range 3: 0.5 hours Here is a solution including tests: Calc public class TimeSpacCalculator { public static TimeSpan