Converting Func <T> to <Func <T>> expression for known T

How would I convert Func<T>

to Expression<Func<T>>

without creating the expression itself? I want to do this for the famous T

i.e. For closed type.

For example,

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
  }
}

      

+3


source to share





All Articles