Sorting list using reflection
<p>I have a table and i want to do sorting function for each column.</p>

<p>Sorting has two direction asc and desc.</p>

<p>1) How can i sort columns using reflection?</p>

<pre><code>List&lt;Person&gt; GetSortedList(List&lt;Person&gt; persons, string direction, string column)
{
    return persons.OrderBy(x =&gt; GetProperyByName(x, column)); //GetPropertyByName - ??
}
</code></pre>

<p>2) Also i want to do something what i can call chain of linq operators:</p>

<pre><code> List&lt;Person&gt; GetSortedList(List&lt;Person&gt; persons, string direction, string column)
    {
         var linqChain;

         if(direction=="up")
         {
             linqChain+=persons.OrderBy(x =&gt; GetProperyByName(x, column))
         }
         else
         {
             linqChain+=persons.OrderByDescending(x =&gt; GetProperyByName(x, column))
         }

         linqChain+=.Where(....);

         return linqChain.Execute();

    }
</code></pre>
