I'm trying to use a single Func<T,bool>
definition to handle a class and its inheritor. This is what I have:
Func<Job, bool> ValidJob =
j => !j.Deleted && !j.OnHold && j.PostDate <= DateTime.Now && j.ExpireDate > DateTime.Now;
public class JobExtended : Job { }
So, given that, the following works:
IQueryable<Job> jobs = ...
jobs.Where(ValidJob);
However, the following does not:
IQueryable<JobExtended> jobs = ...
jobs.Where(ValidJob);
I'm wondering if it's possible to have a single Func<T,bool>
in this situation and, if so, how? I've tried specifying the type arguments as suggested but am having no luck.