Expression tree - how to get at declaring instance?
问题 I'm a newbie when it comes to expression trees, so I'm not sure how to ask this question or what terminology to use. Here's an overly-simplifed version of what I'm trying to do: Bar bar = new Bar(); Zap(() => bar.Foo); public static void Zap<T>(Expression<Func<T>> source) { // HELP HERE: // I want to get the bar instance and call bar.Zim() or some other method. } How can I get to bar inside the Zap method? 回答1: Since the expression passed into your Zap method is a tree, you just need to walk