System.Linq.Dynamic.ExtendedExpressionParser.ExtensionMethod C# (CSharp) Méthode

ExtensionMethod() private méthode

private ExtensionMethod ( Expression instance, string methodName, Lazy args, int errorPos, bool prefixed ) : Maybe
instance System.Linq.Expressions.Expression
methodName string
args Lazy
errorPos int
prefixed bool
Résultat Maybe
		private Maybe<Expression> ExtensionMethod(Expression instance, string methodName, Lazy<Expression[]> args, int errorPos, bool prefixed)
		{
			MethodBase method;
			Expression[] newArguments = prefixed ? args.Value : new[] { instance }.Concat(args.Value).ToArray();
			int count = FindBestMethod(_allowedExtensionMethods, methodName, newArguments, out method);
			if (count == 1)
			{
				return Expression.Call((MethodInfo) method, newArguments);
			}
			if (count > 1)
			{
				throw new ParseException("There are several methods named {methodName}.".Localize(new { methodName }), errorPos);
			}
			return Maybe.Nothing;
		}