title: Most Efficient Way To Represent Time periods
body: <p>I have a need to take a time period, e.g. a week and break it down into days and then further down into either hours, 30 minutes, 15 minutes etc.</p>
  
  <p>Then I want to be able to assign (possibly multiple) people to those time spans.</p>
  
  <p>e.g.</p>
  
  <p>30 May 2012</p>
  
  <p>0700 : 0730 - Alice, Bob</p>
  
  <p>0730 : 0800 - Alice</p>
  
  <p>.... : ....</p>
  
  <p>1930 : 2000 - Alice</p>
  
  <p>31 May 2012</p>
  
  <p>0700 : 0730 - Carol</p>
  
  <p>0730 : 0800 - Carol</p>
  
  <p>.... : ....</p>
  
  <p>1930 : 2000 - Carol</p>
  
  <p>Where the start times and end times each day are customisable.</p>
  
  <p>I need to be able to sort the working periods and do query them to see if any don't have a person assigned to them. Check over a Day / Week that no one person is assigned to > x hours.</p>
  
  <p>I know .Net has TimeSpan and DateTime but these seem cumbersome to use for what is a seems like a simple representation of some data and TimeSpan has no StartTime, it's purely just a span of time (e.g. 30 minutes, 5 minutes, 1 hour etc).</p>
  
  <p>What I had initially in mind was to create a class called WorkingDay, a WorkingDay can have a number of WorkingPeriods. a WorkingPeriod has a StartTime and EndTime and a List of people assigned to that WorkingPeriod with simple methods to AddPerson and RemovePerson.</p>
  
  <p>WorkingDay will have a function to get a list of people assigned for that day by running through the WorkingPeriods and pulling out all unique people that are assigned for any period. It will also have a function that pulls out all WorkingPeriods with no-one assigned.</p>
  
  <p>This seems far too cumbersome though! Especially as I'm going to need something else that takes in a number of WorkingDays and checks that the total time someone is assigned over multiple days is less than x hours etc.</p>
  
  <p>Any suggestions for a good structure for this ? Is their an existing .Net Structure that will provide this which I'm missing ?</p>