array of function
-
Hello everybody. My project is C# project and I want to make an array of function.Is this possible and how to make it? Thanks in advance
-
Hello everybody. My project is C# project and I want to make an array of function.Is this possible and how to make it? Thanks in advance
Using Delegates and the DynamicInvoke method...
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
-
Hello everybody. My project is C# project and I want to make an array of function.Is this possible and how to make it? Thanks in advance
You can't have array of functions. You can have array of delegates referring to function. It would be like
delegate void Function();
Function[] functions = { Function1 , Function2 , Function3 .. };
functions[0](); // calling 1st function:)
Navaneeth How to use google | Ask smart questions
-
You can't have array of functions. You can have array of delegates referring to function. It would be like
delegate void Function();
Function[] functions = { Function1 , Function2 , Function3 .. };
functions[0](); // calling 1st function:)
Navaneeth How to use google | Ask smart questions
can you write me a sample how to define Function1 , Function2 , Function3
-
can you write me a sample how to define Function1 , Function2 , Function3
-
You can't have array of functions. You can have array of delegates referring to function. It would be like
delegate void Function();
Function[] functions = { Function1 , Function2 , Function3 .. };
functions[0](); // calling 1st function:)
Navaneeth How to use google | Ask smart questions
Heh, you could write some fun code with that:
FunctionDelegate[] functions = null;
functions = new FunctionDelegate[]{
delegate(){
functions[0]();
}
};
functions[0]();Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego. -
Hello everybody. My project is C# project and I want to make an array of function.Is this possible and how to make it? Thanks in advance
Yes, but a List<Delegate> might be better.