Homoiconicity for Dummies

Expression trees are a form of data. More specifically, they are the data representation of a piece of code. It’s essential to see that expression trees do not contain the result of executing the code but capture the shape of the code itself. Compiler writers live and breathe such tree representations of code, starting with abstract syntax trees (ASTs).

Although expression trees are much like ASTs, they contain more information than just the syntax that lies at the origin of the expression tree. In addition, every node in an expression tree has reflective information about its data type and the operations it’s representing (like the precise method overload being called or property being looked up). All of this allows ...

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.