Select current week using LINQ

c#, date, dayofweek, linq, where-clause

Solution

Where `date` is the date in question, how about:

    DateTime start = date.Date.AddDays(-(int)date.DayOfWeek), // prev sunday 00:00
        end = start.AddDays(7); // next sunday 00:00

    var qry = from record in data
              where record.Date >= start // include start
               && record.Date < end // exclude end
              select record;

Problem

How do I write the `where` statement that select records with `Date` field between `Sunday` to `Saturday` of a given date. ``` Data Fields: Id, Name, Date ```

Original source