~/talk

Expression trees in C#

Talkat MS Stage 2020 · on Friday, 2020-10-02· [dotnet, compilers-and-language-design]
slides:none on file

Explains what C# expression trees are, shows manual construction with System.Linq.Expressions and compiling them to IL, and benchmarks calling a private method: reflection (slow) → cached MethodInfo → Delegate.CreateDelegate → compiled expression (fastest), with dynamic about 20x slower. Builds a generic three‑quarters operator via compiled expressions, a small calculator DSL parsed with Sprache into Expression trees and compiled, and an ExpressionVisitor that rewrites sin to cos — all working as demonstrated.

AI-written summary · about

  1. 0:00Intro
  2. 0:11Expression Trees in C#
  3. 5:36Expression Tree describes the structure of an expression
  4. 6:51Constructing Expression Trees Manually
  5. 14:07Optimizing Reflection Heavy Code
  6. 19:54Implementing Generic Operators
  7. 25:40Parsing DSLs into Expression Trees
  8. 36:41Preserving Source Code in Assertions
  9. 43:12Transpiling Code into a Different Language
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.