title: Get Every Week's Start and End Date from List<DateTime> using LINQ
body: <p>I have scenario user will give input <strong>Start Date</strong> and <strong>End Date</strong>. i make list of <code>DateTime</code> between that Date Range.</p>
  
  <p>Now I have list of <code>DateTime</code> in a sequence let's say from 1st of this month to 30th of this month and i want to get start and end date of every week in a result set like:</p>
  
  <pre><code>WeekStartDate   WeekEndDate  
  01/01/2015      04/01/2015
  05/01/2015      11/01/2015
  </code></pre>
  
  <p>i have tried myself using linq to get the desired outcome, but i am unable to get my head around to get the desired output, here is my try:</p>
  
  <pre><code>var dating = from d in dates
               group d by new { d.Day, d.DayOfWeek,d.Date } into g
               where g.Key.DayOfWeek == DayOfWeek.Monday || g.Key.DayOfWeek == DayOfWeek.Sunday
               select g;
  </code></pre>
  
  <h2>EDIT:</h2>
  
  <p>i am now able to get week combination but it  not complete as it misses 1st week due Monday check because first date can be other than Monday day:</p>
  
  <pre><code>var dating = from d in dates
               let NextWeekDate = d.Date.AddDays(6)
               group d by new { d.Day, d.DayOfWeek, d.Date, NextWeekDate } into g
               where g.Key.DayOfWeek == DayOfWeek.Monday
               select new { 
                            StartWeekDate = g.Key.Date, 
                            EndWeekDate = g.Key.NextWeekDate 
                          };
  </code></pre>