Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Parsing and Invoking functions problem

Parsing and Invoking functions problem

Scheduled Pinned Locked Moved Managed C++/CLI
helpcsharpdotnetjsonquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arris74
    wrote on last edited by
    #1

    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; }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups