I understand lambdas and the Func
and Action
delegates. But expressions
stump me.
In what circumstances would you use an Expression
I don't see any answers yet that mention performance. Passing Func<>
s into Where()
or Count()
is bad. Real bad. If you use a Func<>
then it calls the IEnumerable
LINQ stuff instead of IQueryable
, which means that whole tables get pulled in and then filtered. Expression
is significantly faster, especially if you are querying a database that lives another server.