title: What is the right syntax for this joined EF Linq query
body: <p>I am trying to get a query that returns everything properly formatted for my ViewModel so I do not have to manually copy everything over from my entity models. I have this Linq query that is giving me an error. :</p>
  
  <pre><code>var query = from i in context.Invoices 
              join l in context.LineItems on i.InvoiceID equals l.InvoiceID into il
              where i.InvoiceID == id
              select new InvoiceViewModel()
                  {
                  InvoiceID = i.InvoiceID,
                  CustomerID = i.CustomerID,
                  InvoiceNote = i.Note,
                  InvoiceDate = i.InvoiceDate,
                  Terms = i.Terms,
                  LineItems = il.ToList&lt;LineItemViewModel&gt;()
                  };
  </code></pre>
  
  <p>This is my ViewModel</p>
  
  <pre><code> public class InvoiceViewModel        {
      public int InvoiceID { get; set; }
      public int CustomerID { get; set; }
      public string InvoiceNote { get; set; }
      public DateTime InvoiceDate { get; set; }
      public string Terms { get; set; }
      public virtual ICollection&lt;LineItemViewModel&gt; LineItems { get; set; }
      }
  
  public class LineItemViewModel        {
      public int LineItemID { get; set; }
      public int InvoiceID { get; set; }
      public int Quantity { get; set; }
      public string Item { get; set; }
      public decimal Amount { get; set; }
      public string LineItemNote { get; set; }
      }
  </code></pre>
  
  <p>The error I am getting is (the red squigly is under the il in LineItems = il.ToList())</p>
  
  <pre><code>'IEnumerable&lt;LineItem&gt;' does not contain a definition for 'ToList' and the best extension method overload 'Enumerable.ToList&lt;LineItemViewModel&gt;(IEnumerable&lt;LineItemViewModel&gt;)' requires a receiver of type 'IEnumerable&lt;LineItemViewModel&gt;'
  </code></pre>
  
  <p>Which I (sorta, kinda, a little) understand. So what is the proper syntax for this?</p>