<p>How do you perform a CROSS JOIN with LINQ to SQL?</p>

[{'answer_id': 56612, 'author': 'Steve Morgan', 'author_id': 5806, 'author_profile': 'https://Stackoverflow.com/users/5806', 'pm_score': 8, 'selected': True, 'text': "<p>A cross-join is simply the Cartesian product of two sets. There's no explicit join operator for it.</p>\n\n<pre>\nvar combo = from p in people\n            from c in cars\n            select new\n            {\n                p.Name,\n                c.Make,\n                c.Model,\n                c.Colour\n            };\n</pre>\n"}, {'answer_id': 679174, 'author': 'Mark Cidade', 'author_id': 1659, 'author_profile': 'https://Stackoverflow.com/users/1659', 'pm_score': 5, 'selected': False, 'text': "<p>Based on Steve's answer, the simplest expression would be this:</p>\n\n<pre><code>var combo = from Person in people\n            from Car    in cars\n            select new {Person, Car};\n</code></pre>\n"}, {'answer_id': 11395783, 'author': 'Rzv.im', 'author_id': 1474780, 'author_profile': 'https://Stackoverflow.com/users/1474780', 'pm_score': 5, 'selected': False, 'text': '<p>The same thing with the Linq extension method <code>SelectMany</code> (lambda syntax):</p>\n<pre><code>var names = new string[] { &quot;Ana&quot;, &quot;Raz&quot;, &quot;John&quot; };\nvar numbers = new int[] { 1, 2, 3 };\nvar newList=names.SelectMany(\n    x =&gt; numbers,\n    (y, z) =&gt; { return y + z + &quot; test &quot;; });\nforeach (var item in newList)\n{\n    Console.WriteLine(item);\n}\n</code></pre>\n'}, {'answer_id': 18937903, 'author': 'amoss', 'author_id': 208068, 'author_profile': 'https://Stackoverflow.com/users/208068', 'pm_score': 4, 'selected': False, 'text': '<p>A <code>Tuple</code> is a good type for Cartesian product:</p>\n\n<pre><code>public static IEnumerable&lt;Tuple&lt;T1, T2&gt;&gt; CrossJoin&lt;T1, T2&gt;(IEnumerable&lt;T1&gt; sequence1, IEnumerable&lt;T2&gt; sequence2)\n{\n    return sequence1.SelectMany(t1 =&gt; sequence2.Select(t2 =&gt; Tuple.Create(t1, t2)));\n}\n</code></pre>\n'}, {'answer_id': 36089869, 'author': 'Denis', 'author_id': 400589, 'author_profile': 'https://Stackoverflow.com/users/400589', 'pm_score': 3, 'selected': False, 'text': '<p>Extension Method:</p>\n\n<pre><code>public static IEnumerable&lt;Tuple&lt;T1, T2&gt;&gt; CrossJoin&lt;T1, T2&gt;(this IEnumerable&lt;T1&gt; sequence1, IEnumerable&lt;T2&gt; sequence2)\n{\n    return sequence1.SelectMany(t1 =&gt; sequence2.Select(t2 =&gt; Tuple.Create(t1, t2)));\n}\n</code></pre>\n\n<p>And use like:</p>\n\n<pre><code>vals1.CrossJoin(vals2)\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/56547', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5556/']