Accepted answer

Try this:

Func<MyObject, bool> datePredicate = (o => o.Date > DateTime.Now.AddDays(-1));


Also when you're doing .SingleOrDefault(), not sure how that will magically turn into a Type since your List<T> is not a List<Type> as far as I know (since Type doesn't have a Date property).


The compiler cannot statically figure out what Type your o parameter is. I would presume o is of type DateTime. Compilers don't make presumptions :)

Predicate<DateTime> datePredicate = o => o.Date > DateTime.Now.AddDays(-1);

Try that.

Related Articles