title: Force evaluation of anonymous type query before storing in session
body: <p>I need to bring back several user specific data sets to bind to drop down lists for a search page that is frequently (re)loaded (potentially not being able to utilize postback data). I want to hit the database once and, when necessary, populate the drop down lists from session data instead of getting it from the database again.</p>
  
  <p>When I set the session (last line, below), will it store the evaluated results, or will referencing the session re-run the queries each time? If the later is the case, what is the best way to force evaluation before setting the session while still maintaining the use of anonymous types?</p>
  
  <pre><code>public class CustomClass
  {
      public IQueryable Results1 { get; set; }
      public IQueryable Results2 { get; set; }
  }
  
  public static CustomClass GetResults()
  {
      var results1 = (
          from t in Table
          select new
          {
              t.Id,
              t.Value
          };
  
      var results2 = (
          from t in Table
          select new
          {
              t.Id,
              t.Value
          };
  
      return 
          new CustomClass
          {
              Results1 = results1,
              Results2 = results2
          };
  }
  
  *****
  
  Session["Results"] = GetResults();
  </code></pre>