linq查询的等效lambda语法

时间:2010-05-25 17:13:17

标签: c# linq

我在这里有一个心灵冻结,但我似乎无法找到等效的lambda语法 -

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

var x = from a1 in a
        from b1 in b
        select new{a1, b1};

2 个答案:

答案 0 :(得分:4)

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

答案 1 :(得分:2)

ReSharper说:

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