i have linq to sql query which i am using to bind grid
var query = (from bottom in
(from d in context.tbl_pl_data
where (d.lng_clientid.Equals(ClientId) && d.str_name.Equals(name) && d.int_deleted.Equals(0))
orderby d.dte_mod_on descending
select d).AsEnumerable()
select new tbl_pl_data
{
lng_id = bottom.lng_id,
str_itemdsc = bottom.str_itemdsc,
dte_cr_on = bottom.dte_cr_on,
str_cr_by = bottom.str_cr_by,
str_mod_by = bottom.str_mod_by,
dte_mod_on = bottom.dte_mod_on
}).ToList().OrderByDescending(d=>d.dte_mod_on).ToList();
Now i want to show this data according to year. I have session that has value of year.. value could be null or list type having single year or multiple year..i mean 2009 or 2009 and 2010. I am getting years value from below session.
Session["UserYearSelected"] = model.str_year_selected.Split(',').ToList();
Now how do i change my above query so that it accepts null or list of year value and compare with dte_cr_on column which is datetime and show data for that particular years only