title: Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'System.Collections.Generic.List<modelClass>
body: <p>I am trying to populate Transaction data where AccountNumber does not exist. I need to access the Account table to get that. I am getting the following error where I am trying to return IEnumerable </p>
  
  <p>Cannot implicitly convert type <code>System.Collections.Generic.IEnumerable&lt;AnonymousType#1&gt;</code> to <code>System.Collections.Generic.List&lt;ProjectModel.Transaction&gt;</code></p>
  
  <p>The error is shown on top of <strong>.ToList();</strong> part of the code. What am I doing wrong? </p>
  
  <p>the code is: </p>
  
  <pre><code>    public static IEnumerable&lt;Transaction&gt;GetAllTransactions()
      {
         List&lt;Transaction&gt; allTransactions = new List&lt;Transaction&gt;();
          using (var context = new CostReportEntities())
          {
              allTransactions = (from t in context.Transactions
                                 join acc in context.Accounts on t.AccountID equals acc.AccountID
                                 where t.AccountID == acc.AccountID
                                 select new 
                                 {
                                     acc.AccountNumber,
                                     t.LocalAmount
                                 }).ToList();
  
          }
          return allTransactions;
  
      }
  </code></pre>