在使用 C# LINQ 语法编写查询时,有没有办法从关键字语法中使用 Queryable.SelectMany 方法?
为了
string[] text = { "Albert was here",
"Burke slept late",
"Connor is happy" };
使用流畅的方法我可以查询
var tokens = text.SelectMany(s => s.Split(' '));
是否有类似于
的查询语法var tokens = from x in text selectmany s.Split(' ')
最佳答案
是的,您只需重复 from ... in 子句:
var words = from str in text
from word in str.Split(' ')
select word;
关于c# - Queryable.SelectMany() 方法是否有 C# LINQ 语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6414816/