title: How to get average of list within lists using linq?
body: <p>I am creating a method that will get a list of business objects that tie for the highest average rating. The method starts with a list of businesses. Each business contains a list of review objects that contain a rating (int). </p>
  
  <p>To illustrate:</p>
  
  <pre><code>list&lt;Review&gt; reviews = curtBusiness.getReviews();
  reviews[1].GetRating();
  </code></pre>
  
  <p>Using a for loop I could find this easily, unfortunately however I am required to use linq, something I have almost no skills at. </p>
  
  <p>Can anyone help me make a linq statement for this query or for a similar query?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I think I may have stumbled into a solution</p>
  
  <pre><code> double average = busInCat.Max(b=&gt; b.GetReviews().Average(r =&gt; r.getRateing()));
          return busInCat.Where(b =&gt; b.GetReviews().Average(r =&gt; r.getRateing()) == average).ToList();
  </code></pre>
  
  <p>If the above code is correct then it first finds the max average of ratings in the first line.</p>
  
  <p>Then in the second line returns a list of of the businesses that have that average rating. Can anyone confirm this is what the linq expressions is doing?</p>