Using the ExpressionVisitor

As mentioned during our discussion about LINQ providers in Chapter 20, expression trees are particularly useful in scenarios where the user’s intent must be interpreted at runtime; for example, to translate query expressions. To achieve this, the compiler delivers on the homoiconicity property for lambda expressions so that users don’t have to write expression trees by hand.

The other stakeholder in this whole picture of runtime interpretation of expression trees is the library or application developer who wants to carry out this analysis of such an expression tree at runtime. Because of the deeply recursive nature of expression trees, this might seem like a frightening task. Luckily, however, it’s a task for which ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.