Parsing and Invoking functions problem
-
Hello, The following code snippet invokes a function by its name. It works fine but the function's name and its arguments must be used separately. What I would like to do is to type in my function from an edit control as it is defined E.g. MyFunc(arg1, arg2). But before invoking it, I assume that I must parse it to get its name and arguments separately. So I am wondering if Dot.Net framework provides either a parsing method that will easily split the function name and the arguments or better an invoke method where I can just pass my function in one shot with all its arguments? Could you please help me to find a straightforward solution?
Object* CInvoker::InvokeMethod(String* method, Object* args[]) { Module* module[] = Assembly::GetExecutingAssembly()->GetModules(false); CExternal* objexternal = new CExternal();//The instance that encapsulates the function to invoke Type* typExternal = module[0]->GetType("CExternal"); MethodInfo* methodinf = typExternal->GetMethod(method); Object* ret = methodinf->Invoke(objexternal, args); return ret; }