且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

“新……具有"是什么?语法在VB Linq中执行?

更新时间:2023-12-03 18:07:34

区别在于,第1个显式创建匿名类型.第二个是查询表达式,可以使用现有类型而不是创建匿名类型.从Cameron MacFarland链接的文档中:

The difference is that the 1st explicitly creates an anonymous type. The 2nd is a query expression, and may use an existing type rather than creating an anonymous type. From the documentation linked by Cameron MacFarland:

查询表达式并不总是需要创建匿名类型.如果可能,它们使用现有类型来保存列数据.当查询返回数据源中的整个记录​​或每个记录中的一个字段时,就会发生这种情况.

Query expressions do not always require the creation of anonymous types. When possible, they use an existing type to hold the column data. This occurs when the query returns either whole records from the data source, or only one field from each record.