查询关键字(C# 参考)Query keywords (C# Reference)

本部分包含在查询表达式中使用的上下文关键字。This section contains the contextual keywords used in query expressions.

本节内容In this section

子句Clause 说明Description
fromfrom 指定数据源和范围变量(类似于迭代变量)。Specifies a data source and a range variable (similar to an iteration variable).
wherewhere 基于由逻辑 AND 和 OR 运算符(&&||)分隔的一个或多个布尔表达式筛选源元素。Filters source elements based on one or more Boolean expressions separated by logical AND and OR operators ( && or || ).
selectselect 指定执行查询时,所返回序列中元素的类型和形状。Specifies the type and shape that the elements in the returned sequence will have when the query is executed.
groupgroup 根据指定的密钥值对查询结果分组。Groups query results according to a specified key value.
intointo 提供可作为对 join、group 或 select 子句结果引用的标识符。Provides an identifier that can serve as a reference to the results of a join, group or select clause.
orderbyorderby 根据元素类型的默认比较器对查询结果进行升序或降序排序。Sorts query results in ascending or descending order based on the default comparer for the element type.
joinjoin 基于两个指定匹配条件间的相等比较而联接两个数据源。Joins two data sources based on an equality comparison between two specified matching criteria.
letlet 引入范围变量,在查询表达式中存储子表达式结果。Introduces a range variable to store sub-expression results in a query expression.
inin join 子句中的上下文关键字。Contextual keyword in a join clause.
onon join 子句中的上下文关键字。Contextual keyword in a join clause.
equalsequals join 子句中的上下文关键字。Contextual keyword in a join clause.
byby group 子句中的上下文关键字。Contextual keyword in a group clause.
ascendingascending orderby 子句中的上下文关键字。Contextual keyword in an orderby clause.
descendingdescending orderby 子句中的上下文关键字。Contextual keyword in an orderby clause.

请参阅See also