.NET - dump statement lambda body to string

前端 未结 2 2088
情话喂你
情话喂你 2021-01-05 08:06

Given the following statement lambda example:

var fMyAction = new Action(() =>
 {
    x += 2;
    something = what + ever; 
 });

What ar

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 08:53

    Read through the tutorial here,

    http://blogs.msdn.com/b/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx

    Pay close attention to the visitor pattern he uses to walk a given expression tree. You should be able to alter it to fit your needs easy enough.

提交回复
热议问题