vendredi 18 août 2017

Performance of Invokemethod

void ExecuteMethodViaReflection(TestObj comm)
{
    var paramNames = comm.paramNames; //of type string array
    var paramData = comm.Data; //of type Object array

    Type t = this.GetType();
    t.InvokeMember(comm.Method, BindingFlags.InvokeMethod, null, this, paramData, null, null, paramNames);
    }

I use above method to invoke method using reflection. I call same method multiple times. Performance of this not great when compared to normal method invocation. Is there a better way i can do to improve performance.





Aucun commentaire:

Enregistrer un commentaire