I have a Func defined as follows:
Func<Foo, bool> IsSuperhero = x => x.WearsUnderpantsOutsideTrousers;
I can query IEnumerables like this:
IEnumerable<Foo> foos = GetAllMyFoos();
var superFoos = foos.Where(IsSuperhero);
But when I try to supply the same Func to the Where method of an IQueryable, I get:
'Cannot convert source type System.Collections.Generic.IEnumerable to System.Linq.IQueryable.'
What's going on? How can I define a Func which will work as a specification for both IEnumerable and IQueryable?