This is because lambdas can be implicitly converted to delegates or to expression trees. In the first case, the delegate is converted to an expression tree because rules
is IQueryable<>
and overload resolution chooses Queryable.Where
. When you use the anonymous function, however, that can't be converted to an expression tree, so overload resolution has to choose Enumerable.Where
.
When you make rules into a List<>
, that forces overload resolution to choose Enumerable.Where
, because List<>
does not implement IQueryable<>
. You could use AsEnumerable()
to achieve the same effect without the overhead of creating the list.
As to why this doesn't work when you're "doing the same thing elsewhere in the same class and it works as I'd expect," we might be able to help if you give an example of code that does work.