I'm trying to check if a date is null in linq and if it isn't check its a future date.
QuestionnaireRepo.FindAll(q => !q.ExpiredDate.HasValue || q.ExpiredDate >DateTime.Now).OrderByDescending(order => order.CreatedDate);
I need the second check to only apply if the first is true. I am using a single repository pattern and FindAll accepted a where clause
ANy ideas? There are lots of similar questions on here but not that give the answer, I'm very new to Linq as you may of guessed :)
Edit: I get the results I require now but it will be checking the > conditional on null values in some cases. Is this not a bad thing?