c# execute a string as code
问题 Here is what i want to do, and i know it is possible with perl, php, python and java, but i am working with c# how can i do the following: public void amethod(string functionName) { AVeryLargeWebServiceWithLotsOfMethodsToCall.getFunctionName(); } I want to pass the functionName to the method and I want it to be executed as above. How this can be done? Do i need ANTLR or any other tool for this? Thanks. 回答1: You can execute a method by name via Reflection. You need to know the type, as well as