I'm getting the Parameter count mismatch exception.
Unhandled Exception: System.Reflection.TargetParameterCountException: Parameter count mismatch.
My code part for invoking the MethodInfo base is as below
Type customerType = executingAssembly.GetType("LateBinding.Customer");
object customerInstance = Activator.CreateInstance(customerType);
MethodInfo method = customerType.GetMethod("printCustomerDetails");
string customerObject = (string)method.Invoke(customerInstance, new object[0]);
I have tried to invoke the below method
public string printCustomerDetails(object parameters)
{
string CustomerName = "";
foreach (object customer in parameters)
{
CustomerName = CustomerName + " " + customer;
}
return CustomerName.Trim();
}
Is there anything I missed to invoke MethodInfo base?