4
假设我有:设置对象属性的Linq表达式树是什么?
class Foo {
public int Bar { get; set; }
}
public void SetThree(Foo x)
{
Action<Foo, int> fnSet = (xx, val) => { xx.Bar = val; };
fnSet(x, 3);
}
我怎么可以重写使用表达式树的fnSet的定义,例如:
public void SetThree(Foo x)
{
var assign = *** WHAT GOES HERE? ***
Action<foo,int> fnSet = assign.Compile();
fnSet(x, 3);
}
您至少需要.Net 4.0作为警告。 – user7116