title: LINQ - Return Value From Field With A Max Value if No Rows Found
body: <p>I have a table like this...</p>
  
  <pre><code>ID   Description  LowThreshold   HighThreshold
  1    BAD          0.0            .69
  2    MEETS        .70            .89
  3    GOOD         .90            2
  </code></pre>
  
  <p>The object here is to write a LINQ query that will select the right Description based on a given decimal. For instance .75 is between .70 and .89, so it would return “MEETS”. BUT, the kicker is, if the Number is higher than all the ranges, automatically return the Description for the record with the highest HighThreshold. So, if I pass in 5, I should get “GOOD” returned.</p>
  
  <p>I have this so far, but it errors out with scores higher than 2, obviously:</p>
  
  <pre><code>private string GetEvaluationDescription (decimal score)
  {
        string evaluationText = myContext.PerformanceRanges.Where
                          (e =&gt;
                                e.LowThreshold &lt;= score
                                &amp;&amp;
                                e.HighThreshold &gt;= score
                          )
                          .Select(eval =&gt; eval.Description).First().ToString();
  }
  </code></pre>
  
  <p>I'd like to accomplish this with just this one query, but my imagination isn't getting me there. I attempted what I found in <a href="https://stackoverflow.com/questions/341264/linq-max-or-default">this</a> post but couldn't get it to work</p>