title: Foreach statement cannot operate on variables of type 'Table1' because 'Table1' does not contain a public instance definition for 'GetEnumerator'
body: <p>I'm getting this error,
  Table1 is the foreign key in the &quot;Table&quot;,
  How can i fix this error?</p>
  <p>Foreach statement cannot operate on variables of type 'Table1' because 'Table1' does not contain a public instance definition for 'GetEnumerator'</p>
  <pre><code>       @if (Model != null)
                                  {
                              @foreach (var items in Model)
                              {
                              @foreach (var aa in items.Table)
                              {
                                 
                                  @foreach ( var bb in aa.Table1)  // I have error in this object
                                  {
      
                                      @foreach (var ee in bb.Table2)
                                      {
      }
  }
  }
  }
  </code></pre>
  <p>Table 1 module</p>
  <pre><code>using System;
  using System.Collections.Generic;
  namespace website.Models
  {
      public partial class Table1
      {
          public Table1()
          {
              Table= new HashSet&lt;Table&gt;();
            
          }
  
          public int Id { get; set; }
          public int? Number { get; set; }
          public int CountryId { get; set; }
          public string Name { get; set; }
          public string ResponsibleName { get; set; }  
         
  
          public Table2 Table2{ get; set; }
         
      }
  }
  </code></pre>
  <p>Table model</p>
  <pre><code>using System;
  using System.Collections.Generic;
  
  namespace website.Models
  {
      public partial class Table
      {
          public Table()
             
          {
              Projects = new HashSet&lt;Projects&gt;();
             
  
          }
  
          public int Id { get; set; }
          public int? ItemId { get; set; }
          public int? ExternalId { get; set; }
          public decimal? Cost { get; set; } 
  
  
          public Table1 Table1{ get; set; }
         
      }
  }
  </code></pre>