C # TimeSpan with exceptions

I know this is probably not possible, but someone knows if there are any shortcuts or mechanisms in .NET to allow me to do this.

I have a "Diary"

9AM - 5PM

Inside this diary, I have events or "Assignments"

10AM - 12PM - Destination 1
1pm - 1:30 pm - Destination 2

What I ask is a tool that I can turn over the diary to give me free space outside of these Destinations.

eg. He will return me the list

9AM - 10AM
12PM - 1PM
1:30 pm - 5 pm

So, I can use in my program.

Any ideas?

+4
source share
3

, CodeProject: .NET, TimeGapCalculator.

+5

, ! CodeProject TimePeriod.

+2

It seems hard to realize yourself:

  • Sort diaries by start date.
  • One free period from the start diary> first meeting
  • One free period from last appointment> daily diary
  • Iterations of assignments and each gap between them - a free period
+1
source

Source: https://habr.com/ru/post/1502615/


All Articles