title: Linq: calling the same method for Where and OrderBy only once instead of twice?
body: <p>I have a simple linq query where I need to filter stores within a certain distance and also order by the distance calculation result, you get the idea.</p>
  
  <p>So, I ended up calling GetDistance method twice for now. How can I optimize code to call it only once per store?</p>
  
  <pre><code>double distance = 50;
  
  var result = stores.Where&lt;MyStore&gt;( s =&gt;
                   Helper.GetDistance( lat, lon, s.Lat, s.Lon ) &lt;= distance )
                  .OrderBy( s =&gt; Helper.GetDistance( lat, lon, s.Lat, s.Lon ) )
                  .ToList();
  </code></pre>