Check if a date is in between collection of Date Periods : <p>I'm trying to find if a given date falls between a collection of periods
I have a period class with start and end dates, and a date to check if it is in the collection of periods. Here is the sample code to work with.</p>

<pre><code>public class Period
{
    public Guid PeriodId { get; set; }

    public DateTime Start { get; set; }
    public DateTime End { get; set; }        
}

...
// main class

public Collection&lt;Period&gt; Periods = Collection of Periods ;
public DateTime TimeToCheck = somedatevalue;

public bool IsTimeInGivenPeriods(TimeToCheck, Periods)
{
     if(TimeToCheck is in Periods)
         return true;
     else
         retrun false;
}
</code></pre>
