Looking at the documented overloads available for the Expression.Call(),
method, I can find the following overloads to obtain an expression node that will perform a call to an instance method expecting:
- no arguments
- two arguments
- three arguments
- four arguments
- variable arguments via an
Expression
array - variable arguments via an
IEnumerable<Expression>
What would be the rationale for not having an overload expecting a single argument?
In my mind, the method signature for the single argument case would be:
public static MethodCallExpression Call(
Expression instance,
MethodInfo method,
Expression arg0);
I don't see any other overloads that would collide with this method signature, so I really don't get why the method is missing.
I understand that the overloads expecting an array or an IEnumerable
would allow me to create an Expression
for the single-argument case, but that would also apply to the other available overloads so I am curious if there is something I don't see that would explain why this overload is missing.
params Expression[] arguments
. that should give you the ability to pass single argument. – EdythMethodCallExpression1
but the instance version does not have a correspondingInstanceMethodCallExpresson1
, it just usesInstanceMethodCallExpressionN
. – ArmilldaInstanceMethodCallExpression1
and aninternal Expression.Call(e, m, e)
that has the comment// COMPAT: This method is marked as non-public to ensure compile-time compatibility for Expression.Call(e, m, null).
. – Armillda