Expression Trees

  • ‘tree like’ data structure
  • each node is expression (method call, equality comparison, binary operation etc.) representing a piece of code
  • you can compile expression tree and run code it represent
  • enables dynamic code generation at runtime
  • LINQ queries on DBs are implemented with Expression Trees
  • used in the dynamic language runtime (DLR)
  • anonymous lambda expression can be converted to ExpressionTree via compiler (i.e. x => x*2 can be represented as tree instead of delegate or anonymous lambda function)

Further read:

https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/expression-trees/

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
16 + 1 =