title: LINQ: Get element with highest of two/multiple values
body: <p>I have a list where each element contains two values (V1 and V2). What I need is the element with the highest V1 and highest V2 (prioritizing V1).</p>
  
  <p>I have tried two approaches:</p>
  
  <ol>
  <li><p>OrderByDescending and ThenByDescending, then take the first element:</p>
  
  <pre><code>list.OrderByDescending(e =&gt; e.V1).ThenByDescending(e =&gt; e.V2).First();
  </code></pre></li>
  <li><p>Select elements with biggest V1, then select the first element with the biggest V2 from this enumerable:</p>
  
  <pre><code>var maxV1 = l.Where(e =&gt; e.V1 == l.Max(e =&gt; e.V1));
  maxV1.First(e =&gt; e.V2 == maxV1.Max(e1 =&gt; e1.V2));
  </code></pre></li>
  </ol>
  
  <p>Both (in my use case) require a fair amount of time and I'm not satisfied with either of my solutions.</p>
  
  <p>The list itself doesn't contain a lot of elements, not more than 100. But there are a lot of them.</p>
  
  <p>Is there another, preferably more efficient, solution than what I've already tried? Or do I have to rethink the whole architecture?</p>
  
  <p>Edit: I forgot to mention that there are more variables in each element which might be used to select the highest value. Which one is used depends on a parameter. So pre sorting using sorted collections doesn't net any benefits.</p>