Decompiling C# expression trees: the lambda that became a tree of factory calls
The same `x => x + 1` compiles two completely different ways depending on the type it is assigned to. As a delegate it is a hidden method and an ldftn; as an Expression<Func<int, int>> it is a nest of Expression.Parameter, Expression.Constant, Expression.Add and Expression.Lambda calls with members referenced by ldtoken. Here is exactly what the compiler emits for an expression tree — captured variables as a Constant of a closure, string equality with its op_Equality, nested lambdas wrapped in Quote — and how a decompiler folds the factory calls back into the lambda you wrote.
