title: How do I specify the Linq OrderBy argument dynamically?
body: <p>How do I specify the argument passed to <code>orderby</code> using a value I take as a parameter?</p>
  
  <p>Ex:</p>
  
  <pre><code>List&lt;Student&gt; existingStudends = new List&lt;Student&gt;{ new Student {...}, new Student {...}}
  </code></pre>
  
  <p>Currently implementation:</p>
  
  <pre><code>List&lt;Student&gt; orderbyAddress = existingStudends.OrderBy(c =&gt; c.Address).ToList();
  </code></pre>
  
  <p>Instead of <code>c.Address</code>, how can I take that as a parameter?</p>
  
  <p>Example </p>
  
  <pre><code> string param = "City";
   List&lt;Student&gt; orderbyAddress = existingStudends.OrderByDescending(c =&gt; param).ToList();
  </code></pre>