title: Dynamically generate expression of property and empty argument
body: <p><strong>Note:</strong> please pay attention carefully this is not a duplicate.</p>
  <p>I need to create the following Lambda expression:</p>
  <pre><code>() =&gt; model.property
  </code></pre>
  <p>the model and its property will be determine at runtime. I want a function that takes the model and property and generate the expression:</p>
  <pre><code>public object GenerateLambda(object model, string property) 
  {
  
  }
  </code></pre>
  <p>If it is possible I don't want the function to be generic.
  but I think the main problem that I have is with <code>()</code> expression.</p>
  <p><strong>Update :</strong> The return type of <code>GenerateLambda</code> is not important for me right now. Any result that could be replaced instead of <code>()=&gt;model.property</code> is accepted. The reason that I used object is that I don't know the generic types of properties and they should be dynamic, but as I tested it is possible to cast object to <code>Expression&lt;Func&lt;TValue?&gt;&gt;</code> which is the the final type that I need(<code>TValue</code> is the property type but it will be determined at runtime).</p>
  <p>I have created a series of Blazor components that have a property(namely <code>For</code>) of type <code>Expression&lt;Func&lt;TValue?&gt;&gt;</code> which is used to extract custom attribute of models. The way I use this property is by setting it to a Func in this way : <code>() =&gt; person.FirstName</code>. Now I need to generate this expression dynamically for each property of the object(model). Suppose that the object and its type themselves are not dynamically created created.</p>
  <p>So for each property p in model I want to call <code>GenerateLambda(object model, string property)</code> that should return <code>() =&gt; model.p</code>.</p>
  <p>pseudo-code:</p>
  <pre><code>foreach(propertyInfo p in model){
     var result= GenerateLambda(model, p, X or any parameter that is needed);
     MyComponent.For= result;
      ... // other logics
  }
  </code></pre>