Q:

Linq datetime date match in query c#

I am trying to match Datetime.Now's only year(as instance Today is 2014).However i could not do inside of linq query by using datetime.now's year.
LevyServiceHelper.GetAllLevyFee().
List.Where(s=>s.ValidDate==Datetime Today Year).ToList();

How can i match Datetime Today Year with s.ValidDate ?
Thanks.

A:

How about
LevyServiceHelper.GetAllLevyFee()

int yr = DateTime.Now.Year;
List.Where(s => s.ValidDate.Year == yr).ToList();

I hope s.ValidDate is DateTime. 
Ned's answer will work for 99.99% of the times. But will fail when while executing query, year changes where as I have taken year in the beginning meaning all validation will happen on same criteria.

A:

LevyServiceHelper.GetAllLevyFee().
List.Where(s=>s.ValidDate.Year == DateTime.Today.Year).ToList();

