How to filter LINQ with date

my code:

var query = from s in ctx.location
        join b in ctx.order on s.locationID
        equals b.ID
        join e in ctx.offerdata on b.OrderID
        equals e.OrderID

        where(e.delDate.ToString().Contains("2013"))

       orderby e.identity_no
       select new Order
       {
    ...

       };

      return query.ToList();

But this ist not working ... so how must my LINQ look like, that ich can only see Orders of 2013 ...

Thanks a lot!

Jon Skeet
people
quotationmark

Well you're really interested in the year, right? So try:

where e.delDate.Year == 2013

EDIT: As we now know that delDate is a DateTime? it would be:

where e.delDate != null && e.delDate.Value.Year == 2013

people

See more on this question at Stackoverflow