title: how to return an anonymous type in linq-to-sql
body: <p>I have the following bogus code, but the idea is to return a generic class</p>
  
  <pre><code> public static var getSeaOf(string user)
          {
              var periodsSettings = from p in sea
                                    where p.add_by == new Guid(user)
                                    select new { p.id, p.name };
  
              return var;
          }
  </code></pre>
  
  <p>I have read here - <a href="https://stackoverflow.com/questions/1070526/how-to-return-anonymous-type-from-c-method-that-uses-linq-to-sql">How to return anonymous type from c# method that uses LINQ to SQL</a> that the best solution for this case is to create a class for the return type. </p>
  
  <p>But my question is if I have hundreds of functions like this does it mean I need to have hundreds of classes?</p>
  
  <p>I hope there is a more generic solution, thanks for your help!!  </p>
  
  <hr>
  
  <p><strong>Edition</strong></p>
  
  <p>I take a look at </p>
  
  <p><a href="https://stackoverflow.com/questions/4347049/silverlight-linqtoentities-how-do-i-return-anonymous-types">Silverlight - LinqToEntities - How Do I Return Anonymous Types</a></p>
  
  <p>But I cannot specified the class name in the select new, like the article does?</p>
  
  <pre><code>public static IEnumerable&lt;retSea&gt; getBskSeasonsOf(string user)
          {
              var periodsSettings = from p in sea
                                    where p.add_by == new Guid(user)
                                    select new retSea { p.id, p.name };
  
              return periodsSettings;
          }
  </code></pre>