title: ascending/descending in LINQ - can one change the order via parameter?
body: <p>I have a method which is given the parameter "bool sortAscending". Now I want to use LINQ to create sorted list depending on this parameter. I got then this:</p>
  
  <pre><code>var ascendingQuery = from data in dataList
                        orderby data.Property ascending
                        select data;
  
  var descendingQuery = from data in dataList
                        orderby data.Property descending
                        select data;
  </code></pre>
  
  <p>As you can see, both queries differ only in "ascending" resp. "descending". I'd like to merge both queries, but I don't know how. Does anyone have the answer?</p>