在我发送的客户机上尝试调用方法时,当使用参数时会引发此错误:
private T CallExternalSoap<T>(object client, string funcName, params object[] args)
{
var type = client.GetType();
var method = type.GetMethod(funcName);
if (method is null)
{
throw new NullReferenceException($"Could not find method {funcName} on object of type {type}.");
}
if (method.GetParameters().Length != args.Length)
{
throw new Exception($"Number of parameters in {args} does not match number of expected parameters in method {funcName} . Expected {method.GetParameters().Length} parameters");
}
var result = (T)method.Invoke(client, args);
return result;
}