title: Dynamic Linq and generic objects - Public member 'Select' on type T not found
body: <p>I'm trying to create a generic method that accepts a collection object, a string representation of the object's type, and a dictionary(of String,String) whose keys contain properties of interest.</p>
  
  <p>I want to then generate a dynamic linq query based on these inputs. It seems though that even after converting the input collection object to a strongly-typed object, dynamic linq won't work - it says <code>Public member 'Select' on type '{T}' not found</code> (where <code>{T}</code> is the strong type).</p>
  
  <p>Here's basically what I've got:</p>
  
  <pre><code>Sub Testing123(ByVal data As Object, ByVal fieldDefs As Dictionary(Of String, String), ByVal myObjectType as String, ByVal myCollectionType As String, ByVal myAssembly As String)
  
      ' Type of object in the collection
      Dim properties = Type.GetType(myObjectType).GetProperties().Where(Function(p) fieldDefs.ContainsKey(p.Name)).ToList()
      ' Get type of the collection object (data)
      Dim thisType = Type.GetType(String.Format("{0},{1}",myCollectionType,myAssembly))
      ' Create strongly-typed collection object
      Dim data2 = Convert.ChangeType(data, thisType)
      ' Resolve select list from input
      Dim selectVars As String = "new (" &amp; String.Join(", ", fieldDefs.Keys.ToList()) &amp; ")"
      ' materialise dynamic query
      Dim result = data2.Select(selectVars) ' ERROR IS HERE
  
      For Each r In result
          Debug.Print(r.Title &amp; " " &amp; r.ViewType)
      Next
  End Sub
  </code></pre>
  
  <p>It works OK if I pass a strongly-typed collection object in (e.g. rather than <code>ByVal data As Object</code>, <code>ByVal data as MyStrongType</code>) and do the equivalent dynamic linq query. But it seems that making the input <code>Object</code>, even though the conversion is successful (have confirmed in debug session), I get this error.</p>
  
  <p>Note that the collection types are custom objects (SharePoint CSOM objects, in case that's helpful), not just <code>List(Of T)</code>.</p>