title: Join LINQ with a List<> in select new
body: <p>hi first time im asking here so il try to do it correctly</p>
  
  <p>i have a problem im making a shopping basket and im nearly there but always a but</p>
  
  <p>what i want to have is something like this</p>
  
  <pre><code>List&lt;HKurv&gt; KurvInnhold = (List&lt;HKurv&gt;)Session["KurvInnhold"];
  DataClasses1DataContext db = new DataClasses1DataContext();
  
  if (Session["KurvInnhold"] != null)
          {
              var query = from a in db.Cabinets
                          from b in db.Commodities
                          from e in db.sArticleNumbers
                          from d in KurvInnhold
  
                          where
                          d.VareKjøpt.Contains(e.ArtNum) &amp;&amp;
                          a.ArticleNumberID == e.ID &amp;&amp;
                          a.ArticleNumberID == b.ArticleNumberID
  
                          select new
                          {
                              BestiltAntall = d.AntallValgt,
                              Price = b.Price,
                              ModelName = a.ModelName,
                          };
  
              Handlekurv1.DataSource = query;
              Handlekurv1.DataBind();
          }
  </code></pre>
  
  <p>But it does not allow for usage of db and list&lt;> in same query</p>
  
  <p>Solved! Modified magnus's answer</p>
  
  <pre><code>            var kjopKollonne = from p in KurvInnhold
                                 select p.VareKjøpt;
  
              var query1 = (from a in db.Cabinets
                           from b in db.Commodities
                           from e in db.sArticleNumbers
  
                           where
                           kjopKollonne.Contains(e.ArtNum) &amp;&amp;
                           a.ArticleNumberID == e.ID &amp;&amp;
                           a.ArticleNumberID == b.ArticleNumberID
                          select new
                           {
                                ArtNum = e.ArtNum,
                                Price = b.Price,
                                ModelName = a.ModelName,
                           }).ToList();
  
              var query2 = from a in query1
                           join b in KurvInnhold on a.ArtNum equals b.VareKjøpt
                           select new
                           {
                                BestiltAntall = b.AntallValgt,
                                Price = a.Price,
                                ModelName = a.ModelName,
                           };
  
              Handlekurv1.DataSource = query2;
              Handlekurv1.DataBind();
  </code></pre>