title: Get a List of property name with Lambda
body: <p>I've this code:</p>
  
  <pre><code>    public string GetPropName&lt;T1, T2&gt;(Expression&lt;Func&lt;T1, T2&gt;&gt; expression)
      {
          var member = expression.Body as MemberExpression;
          if (member != null) return member.Member.Name;
          throw new ArgumentException();
      }
  </code></pre>
  
  <p>With it I can retrieve the name of a property with lamba:</p>
  
  <pre><code>string propName= GetPropName((MyObject o) =&gt; o.MyProperty);
  // propName will be "MyProperty"
  </code></pre>
  
  <p>I want to achieve the same thing but the method should return a list of property name.
  For example:</p>
  
  <pre><code>List&lt;string&gt; PropNames= GetPropName((MyObject o) =&gt; o.MyProp, o.MySecondProp, o.EtcProp);
  //PropNames will contains "MyProp", "MySecondProp", "EtcProp"
  </code></pre>
  
  <p>Do you think it's possible?</p>
  
  <p>Thanks in advance</p>
  
  <p>Edit:</p>
  
  <p>p.s.w.g answer works well!</p>
  
  <p>I've found another alternative:</p>
  
  <pre><code>public List&lt;String&gt; GetPropNames&lt;T&gt;(params Expression&lt;Func&lt;T, object&gt;&gt;[] navigationProperties)
  {
      var result = new List&lt;String&gt;();
      foreach (var navigationProperty in navigationProperties)
      {
          var member = navigationProperty.Body as MemberExpression;
          if (member == null)
          {
              throw new ArgumentException();
          }
          result.Add(member.Member.Name);
      }
      return result;
  }
  </code></pre>
  
  <p>Then I can call it this way:</p>
  
  <pre><code>List&lt;String&gt; MyProps= GetPropNames&lt;MyObject&gt;(e =&gt; e.MyFirstProp, e =&gt; e.MySecondProp,e=&gt; MyEtcProp);
  </code></pre>
  
  <p>It works too. 
  Thanks a lot!</p>