private static void ValidateArgumentCount(MethodBase method, ExpressionType nodeKind, int count, ParameterInfo[] pis)
{
if (pis.Length != count)
{
// TODO: this is for LinqV1 compat, can we just have one exception?
switch (nodeKind)
{
case ExpressionType.New:
throw Error.IncorrectNumberOfConstructorArguments();
case ExpressionType.Invoke:
throw Error.IncorrectNumberOfLambdaArguments();
case ExpressionType.Dynamic:
case ExpressionType.Call:
throw Error.IncorrectNumberOfMethodCallArguments(method);
default:
throw Assert.Unreachable;
}
}
}