title: Querying as if in a loop
body: <p>I have a LINQ in a method that is being passed an array of <code>HalfHour</code> objects, each of which contains a <code>DateAndTime</code> and a <code>HalfHourNumber</code>.</p>
  
  <p>I need to query for each of these separately, and then average the result.  Currently my query only works for the first element (I'm selecting element <code>[1]</code>):</p>
  
  <pre><code>internal static decimal? Average(this IQueryable&lt;LOSSES&gt; query, HalfHour[] array)
  {
       var list = query.ToList();
  
       var numbers = (from q in list
                      where  q.DAY == array[1].DateAndTime.Date
                      select q).Select(x =&gt; Calculations.SingleElement(x, 
                      array[1].HalfHourNumber));
  
       return numbers.Average();
  
  }
  </code></pre>
  
  <p>How would I prevent needing to do this within a loop (calling the query multiple times) yet keep the objects properties associated correctly?</p>