title: Expression.MemberInit -- The best overloaded method match has some invalid arguments
body: <p>I have a question related with the following code; basically I want to create a dynamically LINQ expression that allows me to create a Select sentence in LINQ based in a string:</p>
  
  <pre><code>public class SelectBuilder&lt;T, T&gt;
  {
      Func&lt;T, T&gt; CreateNewStatement(string fields)
      {
          // input parameter "o"
          var xParameter = Expression.Parameter(typeof(T), "o");
  
          // new statement "new Data()"
          var xNew = Expression.New(typeof(T));
  
          // create initializers
          var bindings = fields.Split(',').Select(o =&gt; o.Trim())
              .Select(o =&gt;
              {
  
                  // property "Field1"
                  var mi = typeof(T).GetProperty(o);
  
                  // original value "o.Field1"
                  var xOriginal = Expression.Property(xParameter, mi);
  
                  // set value "Field1 = o.Field1"
                  return Expression.Bind(mi, xOriginal);
              }
          );
  
          // initialization "new Data { Field1 = o.Field1, Field2 = o.Field2 }"
          var xInit = Expression.MemberInit(xNew, bindings); // &lt;-- Error on this line
  
          // expression "o =&gt; new Data { Field1 = o.Field1, Field2 = o.Field2 }"
          var lambda = Expression.Lambda&lt;Func&lt;T, T&gt;&gt;(xInit, xParameter);
  
          // compile to Func&lt;Data, Data&gt;
          return lambda.Compile();
      }
  }
  </code></pre>
  
  <p>This is the LINQ expression:</p>
  
  <pre><code>var vLINQ = (from a in PrimaryTable.AsEnumerable()
                                   join b in vDTsec.AsEnumerable()
                                   on a.Field&lt;Object&gt;("ID") equals b.Field&lt;Object&gt;("ID")
                                   into Group
                                   from q in Group.DefaultIfEmpty()
                                   select q).Select(MYSELECTSTRING);
  </code></pre>
  
  <p>This is the error:
  <img src="https://i.stack.imgur.com/sw0yp.png" alt="Error"></p>
  
  <p>The compiler gives a problem with the Microsoft FW 3.5; with the FW 4.0 or above I don't have problems. But I need to compile the project in 3.5.
  Anybody knows a workaround to this problem?</p>