SUMMARY

You have seen in this chapter that expression trees cover many different scenarios around the idea of handling code at runtime — whether it is the need to understand and analyze code or create it dynamically. Creating code dynamically is more likely to be relevant to a majority of programmers, and in that area expression trees are today the mechanism of choice, instead of the older approaches using reflection or IL emission — at least as long as the slightly restricted expression tree language coverage is sufficient. For a further example, look at Chapter 16, which demonstrates a technique for object cloning that takes advantage of expression trees for dynamic property access.

Get Functional Programming in C#: Classic Programming Techniques for Modern Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.