A similar question was asked here:
Is there an easy way to parse a string (lambda expression) in the action dellet?
As I understand it, this "dynamic query" is actually the basis for limiting the restrictions for the Where clause without using a lambda expression.
The significance of this is that lambda expressions are not dynamic methods, they are anonymous methods. If you ever look at the assembly, you will see that your lambda expressions are converted to closures with any free variables in the form of fields. The class has a method with signatures that matches yours, field variables are assigned at the dial peer.
One good way to think about this is that it means that your lambda expression is interpreted by the C # compiler at compile time, and the variables are resolved by instantiating the object from this class at runtime.
To demonstrate this, consider the following:
var myLambda = x => x * x
You will notice that this will not work. This is because in order to create a linked class / method, the compiler must know the type x at compile time.
All this is important because the concept of a lambda expression does not exist in the CLR at run time (in the same form as in the code). The line that looks like a lambda expression is exactly that ...
Sprague
source share