title: How to create expression(of TDelegate) where delegate type is unknown at compile time?
body: <p>I have a code below to make collection that bind to a gridview able to sort by clicking on the column header. The problem here is "IPerson" is unknown at compile time. I want the delegate type able to decide by getting from gridview datasource.</p>
  
  <pre><code>Dim list As List(Of IPerson) = CType(Session("DataSource"), List(Of IPerson))
  Dim dataType As Type = list.GetType.GetGenericArguments(0)
  Dim param = Expression.Parameter(dataType, e.SortExpression)
  Dim sortExpression = Expression.Lambda(
          Of Func(Of IPerson, Object))(
          expression.Convert(
              Expression.Property(param, e.SortExpression), GetType(Object)
              ), param)
  
  GridView1.DataSource = list.AsQueryable.OrderBy(sortExpression)
  GridView1.DataBind()
  </code></pre>