简体   繁体   English

为什么VB有比LIN#更多的LINQ关键字?

[英]Why does VB have more LINQ keywords than C#?

为什么VB有比LIN#更多的LINQ关键字?

If i remember correctly the only 4 keywords that are available to VB.Net and not C# via the query syntax are 如果我没记错的话,通过查询语法只能使用VB.Net而不是C#的4个关键字

VB.Net added these keywords because we felt it would be valuable to our users. VB.Net添加了这些关键字,因为我们觉得它对我们的用户很有价值。 We envisioned query syntax being a primary way VB.net users would use LINQ and wanted to enable as many scenarios as possible via the syntax. 我们设想查询语法是VB.net用户使用LINQ的主要方式,并希望通过语法启用尽可能多的场景。

I do not know why C# left these out. 我不知道为什么C#把它们排除在外。 My speculation is that they didn't feel the scenario justified the cost especially considering the feature is still available via extension methods. 我的猜测是他们并不认为这种情况证明了成本是合理的,特别是考虑到该功能仍然可以通过扩展方法获得。

EDIT Added Aggregate and a few others (thanks Dario and Chris!) 编辑添加了Aggregate和其他一些(感谢Dario和Chris!)

The VB team decided to create more language extensions than the C# team did (in terms of keywords that translate to standard query operators). VB团队决定创建比C#团队更多的语言扩展(就转换为标准查询运算符的关键字而言)。 I chalk this up to different teams having different design goals. 我将其归功于具有不同设计目标的不同团队。

Fortunately both languages have full access to all of the standard query operators that are available so there is no loss of functionality. 幸运的是,这两种语言都可以完全访问所有可用的标准查询运算符,因此不会丢失任何功能。

Check if you have Menu 检查您是否有菜单

Tools > Options > Text Editor > C# -> Statment Completation -> Hide advanced members 

unckecked, if this is check means you have members hidden from you. unckecked,如果这是检查意味着你有成员隐藏你。 This is created by VS Team for help and simplify tasks to newbies. 这是由VS团队创建的,用于帮助并简化新手的任务。

对于C#具有VB不具有的LINQ的半“LINQ”的一个关键字是yield

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM