Getting hours occupied in a day
<p>Say I have a variable <code>DayHours</code> and a <code>DateTime</code> called <code>CurrentDay</code>.</p>

<p>I have events with a start date, an end date, and hours. They all fall within <code>CurrentDay</code>
If it is the last day of the event and the end date == <code>CurrentDay</code>, then I need the remainder. So if a day lasts 5 hours and an event is 14 hours and today is the last day, I would return 4.</p>

<p>If the event starts and ends on the same day, I return its hours. If an event is multiple days and <code>CurrentDay</code> is not the last day of the event, I return <code>DayHours</code>.</p>

<p>How could I do this in C#?</p>
