I have 100 method like
public void function1() {}
public void function2() {}
....
public void function100() {}
The question is how can i call these function without calling them one by one? or how can i call a function from a string like:
string S = "TheFunction"+x.Tostring()+"()";
What class are your methods on? You can get an array of the methods in your class like so:
Then you can loop and invoke:
classInstanceOfYourClass
is an object instance of the class on which you are doing this. The second parameter of invoke, (I set it tonull
) is for passing arguments to the method. If you passnull
, you are saying that the method has no arguments.