Equivalent lambda syntax for linq query

I have a mind freeze here, but I cannot find the equivalent lambda syntax for -

string[] a = {"a","b","c"}; 
string[] b = {"1","2","3"}; 

var x = from a1 in a
        from b1 in b
        select new{a1, b1};
+3
source share
2 answers
var x = a.SelectMany(a1=>b.Select(b1=>new {a1,b1}));
+4
source

ReSharper says:

var x = a.SelectMany(a1 => b, (a1, b1) => new { a1, b1 });
+2
source

Source: https://habr.com/ru/post/1747061/


All Articles