sdk/dotnet/src/Microsoft.Datasync.Client/Query/OData/ODataExpressionParser.cs
/// <summary>
/// Validates that the function has the right number of arguments.
/// </summary>
/// <param name="functionName">The name of the function.</param>
/// <param name="functionArgs">The list of arguments.</param>
/// <param name="errorPos">The position of the start of the function call expression.</param>
/// <exception cref="ODataException">If the function call is not valid.</exception>
Validates that the function has the right number of arguments.
Validates that the function has the right number of arguments .
private void ValidateFunction(string functionName, IList<QueryNode> functionArgs, int errorPos)
        {
            if (functionArgCount.ContainsKey(functionName))
            {
                if (functionArgs.Count != functionArgCount[functionName])
                {
                    throw new ODataException($"Function '{functionName}' requires {functionArgCount[functionName]} arguments.", lexer.Text, errorPos);
                }
            }
            else if (functionName == "substring" && functionArgs.Count != 2 && functionArgs.Count != 3)
            {
                throw new ODataException("Function 'substring' requires 2 or 3 arguments.", lexer.Text, errorPos);
            }
        }
private void ValidateFunction ( string functionName , IList < QueryNode > functionArgs , int errorPos ) { if ( functionArgCount . ContainsKey ( functionName ) ) { if ( functionArgs . Count != functionArgCount [ functionName ] ) { throw new ODataException ( $" Function ' { functionName } ' requires  { functionArgCount [ functionName ] }  arguments. " , lexer . Text , errorPos ) ; } } else if ( functionName == " " && functionArgs . Count != 2 && functionArgs . Count != 3 ) { throw new ODataException ( " " , lexer . Text , errorPos ) ; } }
Validates that the function has the right number of arguments.
Validates that the function has the right number of arguments .
If the function call is not valid.
If the function call is not valid .
functionName
string
The name of the function.
The name of the function .
functionArgs
IList<QueryNode>
The list of arguments.
The list of arguments .
errorPos
int
The position of the start of the function call expression.
The position of the start of the function call expression .