title: Condition in lambda expression order by
body: <p>I have 2 Lists that return the same Item .
  <code>&lt;foo&gt;</code> has the propriety <code>orderType</code> that is 0 for the first list and 1 for the second one 
  On the first list I do filtering and I have to add the items from the second list to the result that is limited by pagination. 
  Basically this is my final Query :</p>
  
  <pre><code>var listFoo= QueryList1.Concat(QueryList2);  //(IQueriable)
  List&lt;foo&gt; listFoo =listFoo.OrderByDescending(r =&gt; r.ID)
                            .ThenBy(d =&gt;d.orderType)
                            .Skip((currentPageIndex - 1) * pageSize)
                            .Take(pageSize)
                            .ToList();
  </code></pre>
  
  <p>This works great because list 1 works as main item and list 2 works as details for first list. Also my filters should work only on the first list. But the problem comes here. How can I order the second list <strong>only</strong> by date. I need to list the details ordered by date. 
  Basically i need something like : </p>
  
  <pre><code>List&lt;foo&gt; listFoo =listFoo.OrderByDescending(r =&gt; r.ID)
                            .ThenBy(d =&gt;d.orderType)
                            .ThenBy(x=&gt;(x.ordertype==1)?x.Date)
                            .Skip((currentPageIndex - 1) * pageSize)
                            .Take(pageSize)
                            .ToList();
  </code></pre>
  
  <p>Edit : </p>
  
  <pre><code>List 1 : 
  id =1,ordertype=0,Date = new DateTime(1950,1,4),  [0]
  id =2,ordertype=0,Date = new DateTime(1950,2,1)   [1]
  List 2 :
  id =1,ordertype=1,Date = new DateTime(1950,1,5),  [2]
  id =1,ordertype=1,Date = new DateTime(1950,1,2),  [3]
  id =1,ordertype=1,Date = new DateTime(1950,1,3),  [4]
  id =1,ordertype=1,Date = new DateTime(1950,1,4)   [5]
  
  This should be ordered as follows : 
  [0],[3],[4],[5],[2],[1]
  </code></pre>