title: How to fix "Anonymous type does not contain a definition for 'field'" error in linq join?
body: <p>I have a dataset that has a datatable table1 that contains columns</p>
  
  <p><em>PlantId, PlantName, OrderWeek, supplierId, SupplierName, GroupId, GroupName, WeekDay, OrderCount, ReservedCount</em></p>
  
  <p>Then I have an enumerable GroupedByDate that has fields <em>OrderWeek, WeekDay, Supplier, SupplierId, PlantId, DeliveredCount</em></p>
  
  <p>That is created by </p>
  
  <pre><code>var GroupedByDate = from r in dsDta.Tables[0].Rows.Cast&lt;DataRow&gt;()
                      let eventTime = (DateTime)r["EntryTime"]
                      group r by new
                      {
                          WeekStart = new DateTime(eventTime.Year, eventTime.Month, eventTime.AddDays(-(int)(eventTime.DayOfWeek + 6) % 7).Day),
                          WeekDay = eventTime.DayOfWeek
                      } 
                      into g
                      select new
                      {
                          g.OrderWeek,
                          g.WeekDay,
                          g.Supplier,
                          g.SupplierID,
                          g.PlantId,
                          DeliveredCount = g.Count()
                      };
  </code></pre>
  
  <p>I would like to join these data using</p>
  
  <pre><code>var result = from T1 in table1.Rows.Cast&lt;DataRow&gt;() 
                           join T2 in GroupedByDate 
                           on new
                           {
                               PlantID = T1.Field&lt;int&gt;("PlantId"),
                               SupplierID = T1.Field&lt;int&gt;("SupplierId"),
                               OrderWeek = T1.Field&lt;DateTime&gt;("OrderWeek"),
                               WeekDay = T1.Field&lt;int&gt;("Weekday")
  
                           }
                           equals new
                           {
                               T2.PlantID,
                               T2.SupplierID,
                               T2.OrderWeek,
                               T2.WeekDay
  
                           } into JoinedData
                           from TotalData in JoinedData
                           select new
                           {
                               PlantId = TotalData.PlantID,
                               PlantName = T1.Field&lt;string&gt;("PlantName"),
                               OrderWeek = TotalData.OrderWeek,
                               SupplierId = TotalData.SupplierID,
                               SupplierName = T1.Field&lt;string&gt;("SupplierName"),
                               GroupId = T1.Field&lt;int&gt;("FuelGroupId"),
                               GroupName = T1.Field&lt;string&gt;("FuelGroupName"),
                               Weekday = TotalData.WeekDay,
                               OrderCount = T1.Field&lt;int&gt;("OrderCount"),
                               ReservedCount = T1.Field&lt;int&gt;("ReservedCount"),
                               DeliveredCount = TotalData.Field&lt;int&gt;("DeliveredCount")
                           };
  </code></pre>
  
  <p>Everyting goes fine except the last line </p>
  
  <pre><code>DeliveredCount = TotalData.Field&lt;int&gt;("DeliveredCount")
  </code></pre>
  
  <p>brings me an error:</p>
  
  <p>Error   CS1929  '' does not contain a definition for 'Field' and the best extension method overload 'DataRowExtensions.Field(DataRow, string)' requires a receiver of type 'DataRow'.</p>
  
  <p>What's wrong with my code?</p>