Today in an interview (junior web developer) the interviewer asked me this question:
How you can execute a Method when you have its name as a string ( in
javascript and in C# )
I can not answer 🙁
Now when I searched I found this question How to execute a JavaScript function when I have its name as a string
but how do this in c# ??
If you just have name of the method than you can make use of
.net Relfectiononly to run that method..Check : MethodBase.Invoke Method (Object, Object[])
or
Example :