I work with code that dynamically creates an instance of the SoapHttpClientProtocol
object (proxy class) and uses this object to call WS-Basic I Web Service. Here is a simplified version of my code:
public override object Call(Type callingObject, string method, object[] methodParams, string URL) { MethodInfo requestMethod = callingObject.GetMethod(method);
I noticed that in some cases, calling Activator.CreateInstance()
can take a considerable amount of time, so I'm trying to optimize the code using a lambda expression :
public override object Call(Type callingObject, string method, object[] methodParams, string URL) { MethodInfo requestMethod = callingObject.GetMethod(method);
Unfortunately, this code does not create an object of type callingObject
(instead, it returns a delegate object Func<T>
), and therefore, when it tries to set Url
in the next line, it throws an exception:
System.MissingMethodException: Attempted to access a missing item.
Am I missing something in my code?
Thanks!
source share