title: Timespan intersection in c#
body: <p>Let's say i have 2 date ranges. </p>
  
  <p>Those date ranges could be represented as time spans. </p>
  
  <p>i want to find a date range, that falls within the two time spans. </p>
  
  <pre><code>Range 1: 2/1/2011 - 8/1/2011 (timespan of 6 months)
  Range 2: 5/2/2011 - 5/28/2011 (timespan of 26 days)
  </code></pre>
  
  <p>so in this case, the intersection would be 5/2/2011-5/28/2011, but the ranges could move in either direction, (or not intersect at all in which case i'd want the resulting timespan to be 0 length)</p>
  
  <p>in the end, i need the calendar dates of start/end of the resulting intersection time span (not just ticks/hours/days etc)</p>
  
  <p>is there a elegant way to do this in c# 3.0? </p>
  
  <p>UPDATE</p>
  
  <p>i took StriplingWarriors code and created a method out of it.. </p>
  
  <pre><code>    private static DateRange GetIntersectionRange(DateRange range1, DateRange range2) {
          var iRange = new DateRange();
          iRange.From = range1.From &lt; range2.From ? range2.From : range1.From;
          iRange.To = range1.To &lt; range2.To ? range1.To : range2.To;
          if (iRange.From &gt; iRange.To) iRange = null;
          return iRange;
      }
  </code></pre>