Queryable.SelectMany() 方法是否有 C# LINQ 语法?
使用 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(' ')
When writing a query using C# LINQ syntax, is there a way to use the Queryable.SelectMany method from the keyword syntax?
For
string[] text = { "Albert was here",
"Burke slept late",
"Connor is happy" };
Using fluent methods I could query
var tokens = text.SelectMany(s => s.Split(' '));
Is there a query syntax akin to
var tokens = from x in text selectmany s.Split(' ')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,您只需重复 from ... in 子句:
Yes, you just repeat the from ... in clause:
您可以使用Compound from Clause:
You can use a Compound from Clause:
您的查询将被重写为:
这是一个很好的页面,其中有几个并排的 Lambda 和查询语法示例:
选择多个运算符第 1 部分 - Zeeshan Hirani
Your query would be re-written as:
Here's a good page that has a couple of side-by-side examples of Lambda and Query syntax:
Select Many Operator Part 1 - Zeeshan Hirani