How do I take the Cartesian join of two lists in c#?

Assuming you mean a “cross join” or “Cartesian join”:

var query = from x in firstList
            from y in secondList
            select new { x, y }

Or:

var query = firstList.SelectMany(x => secondList, (x, y) => new { x, y });

If you want something else (as you can see from comments, the term “cross product” has caused some confusion), please edit your question appropriately. An example would be very handy 🙂

Leave a Comment