I am using RabbitMQ to communicate between applications (RPC) and I have a dilemma of what is the appropriate way to call the method I need. I have a class which contains a bunch of available methods, and I need to execute the one that matches the string carried in my Rabbit message.
Option1: Using the method shown HERE is much cleaner and nicer to look at, but I wonder if it has anything against it. e.g. performance penalty, bad practice, etc
var method = this.GetType().GetMethod(methodNameString);
method.Invoke(this, messagebody);
Option2: Using a switch
switch(methodNameString)
case: method1
method1();
case: method2
method2();
...