sdk/dotnet/src/Microsoft.Datasync.Client/Query/OData/ODataExpressionParser.cs
/// <summary>
/// Parses the current expression as a <c>$orderBy</c> OData string.
/// </summary>
/// <returns>The list of <see cref="OrderByNode"/> elements representing the statement.</returns>
Parses the current expression as a $orderBy
Parses the current expression as a $orderBy
internal IList<OrderByNode> ParseOrderBy()
        {
            var orderings = new List<OrderByNode>();
            while(true)
            {
                QueryNode expression = ParseExpression();
                OrderByDirection direction = OrderByDirection.Ascending;
                if (TokenIsIdentifier("asc"))
                {
                    lexer.NextToken();
                }
                else if (TokenIsIdentifier("desc"))
                {
                    lexer.NextToken();
                    direction = OrderByDirection.Descending;
                }
                orderings.Add(new OrderByNode(expression, direction));
                if (lexer.Token.Kind != QueryTokenKind.Comma)
                {
                    break;
                }
                lexer.NextToken();  
            }
            ValidateTokenIsType(QueryTokenKind.End, "The specified OData $orderBy expression has syntax errors.");
            return orderings;
        }
internal IList < OrderByNode > ParseOrderBy ( ) { var orderings = new List < OrderByNode > ( ) ; while ( true ) { QueryNode expression = ParseExpression ( ) ; OrderByDirection direction = OrderByDirection . Ascending ; if ( TokenIsIdentifier ( " " ) ) { lexer . NextToken ( ) ; } else if ( TokenIsIdentifier ( " " ) ) { lexer . NextToken ( ) ; direction = OrderByDirection . Descending ; } orderings . Add ( new OrderByNode ( expression , direction ) ) ; if ( lexer . Token . Kind != QueryTokenKind . Comma ) { break ; } lexer . NextToken ( ) ; } ValidateTokenIsType ( QueryTokenKind . End , " " ) ; return orderings ; }
Parses the current expression as a $orderBy
Parses the current expression as a $orderBy
// Eat the comma
The list of  elements representing the statement.
The list of elements representing the statement .