This little puzzle has been bugging me for some time. I'm trying to
create a little service that will check a time frame and compare it to
another timeframe (start / stop time). A real-world example is as
follows:
Patsy would like to volunteer time at a booth this year at the fair.
Her optimal timeframe to volunteer is between 1:00pm and 5:00pm and she
inputs this via some form. Let's say that I want to compare this to a
Dictionary<Date Time, DateTimethat stores start-times and end-times.
So I could get back available timeframes such as:
12:00pm, 1:00pm
1:00pm, 2:30pm
2:30pm, 3:30pm
3:30pm, 4:00pm
4:30pm, 5:30pm
The first timeframe obviously won't work because it starts at 12:00pm.
The last timeframe won't work because while it starts at 4:30pm it's not
over until 5:30pm.
I know that TimeSpan is a span of time between 2 times. Here I actually
have 4 times. What is the quickest way (if any) to make sure the first
timeframe satisfies one or more of the other timeframes. There has got
to be a simple way to compare timeframes in the .NET Framework. I just
haven't stumbled upon it.
Any help is greatly appreciated.
Thanks in advance,
Will
*** Sent via Developersdex http://www.developersdex.com ***