title: "Member access 'DataType MemberName' of 'Namespace.ClassName' not legal on type 'System.Collections.Generic.IEnumerable`1[Namespace.ClassName]."
body: <p>I would love a solution to my current problem, but I would love EVEN MORE if I can understand what that error actually means.</p>
  
  <p>I have LINQ to SQL classes for two tables in my DB: <strong>Providers</strong> and <strong>Assignments</strong>. I added the following member to the Provider class:</p>
  
  <pre><code>public IEnumerable&lt;Assignment&gt; Assignments 
      {
          get
          {
              return (new linqDataContext())
                  .Assignments
                  .Where(a =&gt; a.ProviderID == this.ProviderID);
          }
      }
  </code></pre>
  
  <p>Then, I bind a GridView using a query that pulls from the parent <strong>Provider</strong> and uses the child member <strong>Assignments</strong>, like this:</p>
  
  <pre><code>protected void PopulateProviders()
      {
          linqDataContext context = new linqDataContext();
          var list = from p in context.Providers
                     where (p.Assignments.Count(a =&gt; a.Category == ddlCategory.SelectedValue) &gt; 0)
                     select p;
  
          lvProviders.DataSource = list;
          lvProviders.DataBind();
      }
  </code></pre>
  
  <p>At .DataBind(), when it actually runs the query, it throws the following error:</p>
  
  <blockquote>
    <p>Member access 'System.String Category' of 'Namespace.Assignment' not legal on type 'System.Collections.Generic.IEnumerable`1[Namespace.Assignment].</p>
  </blockquote>
  
  <p>I've tried checking for nulls (a => a != null &amp;&amp; a.Category ...) but that hasn't worked. I'm not sure what to try next. I think that, if I knew what the error is trying to tell me, I could find the solution. As it stands, I don't know why member access would be illegal.</p>