title: Implementing IEnumerable
body: <p>I am using LINQ and am having a hard time understanding how I can make new "domain model" classes work within LINQ while querying across tables.  I am using Linq to SQL, and C# in .NET 3.5.</p>
  
  <p>Suppose I want an Extended Client class:</p>
  
  <pre><code>public class ExtendedClient 
  {
      public int ID { get; set; }
      public string Name { get; set; }
      public string strVal { get; set; }
  }
  </code></pre>
  
  <p>and in my data layer, I want to populate this from two tables (dc is my DataContext):</p>
  
  <pre><code>public ExtendedClient getExtendedClient(int clientID)
  {
      var c = dc.GetTable&lt;tClient&gt;();
      var cs = dc.GetTable&lt;tClientSetting&gt;();
      var q = from client in c
              join setting in cs
              on client.ClientID equals setting.ClientID
              where client.ClientID == clientID
              select new ExtendedClient { client, setting.strValue };
      return q;   
  }
  </code></pre>
  
  <p>I am trying to return the row in the table tClient plus one extra column in tClientSetting.</p>
  
  <p>The annoying errors I get are :
  Cannot initialize type 'ExtendedClient' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
  and
  Cannot implicitly convert type 'System.Linq.IQueryable' to 'ExtendedClient'. An explicit conversion exists (are you missing a cast?)</p>
  
  <p>I realize this is a basic error, but I cannot determine how BEST to implement the IEnumerable because I cannot find an example. </p>
  
  <p>Do I have to do this <em>every time</em> I want a specialized object?  Thanks in advance.</p>