I'm calling a methods using reflections. However due to some requirement one of the method parameters are changed and keeping new parameters as optional parameters. here is code
Void Method1(string request, string constants, string count = null)
Void Method2(string request, string constants)
In Method1 count parameter is optional.For the above methods, I'm calling using reflections Here is the code :
result = methodInfo.Invoke(classInstance, new object[] {request, constants});
I have tried with below approach but getting exception
result = methodInfo.Invoke(classInstance, new object[] {request, constants ,System.Type.Missing});
Got below exception for Method2 the above code is working for Method1
Parameter count mismatch.
Please suggest me for optional parameters in method using reflections
Thanks in Advance!