title: How to select a single object using Linq in vb.net
body: <p>I have done a lot of searching to what appears to be a simple LINQ problem but I can't figure out how to do grab an object out of a collection that has a specified minimum (or max value) without resorting to a sort like this:</p>
  
  <pre><code>dim customers= GetCustomers()
  
  dim youngest = (From c in customers
                   Order By c.age Ascending).ToList.First
  </code></pre>
  
  <p>This (untested code) structure works fine with the exception that the entire customer array must be sorted and placed into a list for the only purpose of extracting the first value.  That can't be the best way to get the minimum!</p>
  
  <p>Note that I want the whole c record in this case, <strong>not</strong> the minumum age of a customer that can be done like this (a typical example):</p>
  
  <pre><code>dim customers= GetCustomers()
  
  dim youngest = (From c in customers
                   Select c.age).Min
  </code></pre>
  
  <p>Or even</p>
  
  <pre><code>dim customers= GetCustomers()
  
  dim youngest = (From c in customers
                   Select c).Min(Function(x) x.age)
  </code></pre>
  
  <p>I can't for the life of me figure out how to get the whole object (or even the index) without resorting to the sort...</p>