I am currently working on a C# program where I have the need to combine a bunch of time ranges. For each range I have the start and end time. I found an example where this was being done in Ruby but not for C#. I am basically looking for the time range union. I feel like there might be a way to do this using linq but I cant come up with it. Any ideas?
So for example
Start Time: 1:30
End Time: 2:00
Start Time: 1:45
End Time: 2:30
Start Time: 3:00
End Time: 5:00
Start Time: 4:00
End Time: 4:30
Start Time: 4:45
End Time: 5:30
This set of times would come back as
Start Time: 1:30
End Time: 2:30
Start Time: 3:00
End Time: 5:30
You could have a look at this project which supports
TimeRangesand intersection methods:http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET