How to execute a function by getting the name of the function to execute from a stri

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emil Emil
    New Member
    • Feb 2012
    • 1

    How to execute a function by getting the name of the function to execute from a stri

    Hi, I'm looking for a way to call a number of functions/methods in foreach, like smthg below, please help !!!
    Code:
    string[] sScripts =
             {
               "MyAppsScript()",
               "ProfilesScript()"
             };
    
    foreach (var sScript in sScripts)
    {
    
      //execute scripts here
    
    }
    Last edited by Frinavale; Feb 27 '12, 09:14 PM. Reason: Added code tags. Please post code in code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Instead of using string use delegates.

    Look up the topic of delegates.


    -Frinny

    Comment

    Working...