C# Programming/Keywords/orderby
The orderby
contextual keyword is used to define the sort order of query results. Specifying orderby
key1 ascending
sorts from the smallest first to the largest at the end, while orderby
key2 descending
sorts from the largest first to the smallest at the end. The default sort order is ascending
and if neither direction is specified, results will be sorted in ascending order. Multiple keys may be used to sort, with the first one specified being the primary sort and later entries providing secondary sorts when the first key matches, e.g., orderby
lastName ascending
, firstname ascending
.
C# Keywords | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Special C# Identifiers (Contextual Keywords) | |||||||||||||||
| |||||||||||||||
Contextual Keywords (Used in Queries) | |||||||||||||||
|