SelectMany Translation for an Equi-join Expression in C# LINQ

var query7 = from c in CustomerList from o in OrderList where c.Country == "USA" &amp;&amp; o.CustomerID == c.CustomerID select new { o, c }; //Translates to: query7 = from c in CustomerList.SelectMany(o =&gt; OrderList, (c, o) =&gt; <div><a href=""></a><a href="">buy cialis online canada</a><a href="">online cialis</a><a href="">canada pharmacy viagra</a><a href="" title="serendipity and viagra">serendipity and viagra</a><a href="">pharmacy in canada</a><a href="">buy viagra online</a><a href="">pharmacy in canada</a><a href="">generic cialis</a></div>  new { c, o }) where (c.c.Country == "USA") &amp;&amp; (c.o.CustomerID == c.c.CustomerID) select new { c.o, c.c }; foreach (var x in query7) sbResult.Append(String.Format("CustomerID = {0}, CompanyName = {1}, OrderID = {2}\r\n", x.o.CustomerID, x.c.CompanyName, x.o.OrderID));

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.