将Func <t>转换为Expression <func <t>&gt;对于已知的T </func <t> </t>

时间:2014-08-04 00:13:37

标签: c# .net

如何在不实际编写表达式的情况下将Func<T>转换为Expression<Func<T>>?我想为已知的T执行此操作,即对于封闭类型。

例如

class Person 
{
  public static Func<Person> Factory { get { return () => new Person(); } }

  public static Expression<Func<Person>> ToExpression(Func<Person> personFactory)
  {
    // this is what I am asking
  }
}

0 个答案:

没有答案