ascending(C# 参考)ascending (C# Reference)

查询表达式中的 orderby 子句 中使用 ascending 上下文关键字指定排序顺序为从小到大。The ascending contextual keyword is used in the orderby clause in query expressions to specify that the sort order is from smallest to largest. 由于 ascending 为默认排序顺序,因此无需加以指定。Because ascending is the default sort order, you do not have to specify it.

示例Example

下面的示例说明 ascendingorderby 子句中的用法。The following example shows the use of ascending in an orderby clause.

IEnumerable<string> sortAscendingQuery =
    from vegetable in vegetables
    orderby vegetable ascending
    select vegetable;

请参阅See also