title: Linq group string array by count and sort
body: <p>I have a <code>List&lt;string&gt; _words</code> like</p>
  
  <pre><code>"Car", "Car", "Car", "Bird", "Sky", "Sky"
  </code></pre>
  
  <p>I want to sort it by each word count descending so the final <code>List&lt;string&gt;</code> would be</p>
  
  <pre><code>"Car",
  "Sky",
  "Bird
  </code></pre>
  
  <p>how do I do this in LINQ? I don't really need the count for each word</p>
  
  <p>in SQL this would be:</p>
  
  <pre><code>select word, count(1) as count1
  from word
  group by word
  order by count1 desc, word
  </code></pre>
  
  <h2>Answer</h2>
  
  <p>Another variant:</p>
  
  <pre><code>    var _output = from p in _words
                    group p by p into g
                    orderby g.Count() descending, g.Key ascending 
                    select g.Key;
  </code></pre>