I was vaguely aware of that class before this since I looked into how dynamic works in RazorEngine for a big. However, most of this stuff I figured out by writing the normal dynamic code (see comment) in LinqPad and then switching over the IL tab.

There was a period where I had two tabs, one with this code, one with the dynamic code and I was literally beyond comparing the generated IL and modifying until it matched :-/