title: How to order by multiple columns using VB.Net lambda expressions
body: <p>I've done a brief search of this site, and googled this, but can't seem to find a good example. I'm still trying to get my head around the whole "Lambda Expressions" thing.</p>
  
  <p>Can anyone here give me an example ordering by multiple columns using VB.Net and Linq-to-SQL using a lambda expression?</p>
  
  <p>Here is my existing code, which returns an ordered list using a single-column to order the results:</p>
  
  <pre><code>Return _dbContext.WebCategories.OrderBy(Function(c As WebCategory) c.DisplayOrder).ToList
  </code></pre>
  
  <p>Note: The WebCategory object has a child WebPage object (based on a foreign key). I'd like to order by WebPage.DisplayOrder first, then by WebCategory.DisplayOrder.</p>
  
  <p>I tried chaining the order bys, like below, and though it compiled and ran, it didn't seem to return the data in the order I wanted.</p>
  
  <pre><code>Return _dbContext.WebCategories.OrderBy(Function(c As WebCategory) c.DisplayOrder).OrderBy(Function(c As WebCategory) c.WebPage.DisplayOrder).ToList
  </code></pre>
  
  <p>Thanks in advance.</p>