The Way to Programming
The Way to Programming
Let’s say I want to have some arbitrary functions like:
MyFunc(1, 2, "hello") AnotherFunc(25.3, "have a good day", "here's another string", 22)
Can I pass this function off to a function that takes arbitrary functions that will get called later when some event occurs?
I’m not at all interested in events – just the syntax to call these functions later on….
In JavaScript, this is super simple. Not sure if this is possible in C#.
MyFunc(1, 2, "hello") AnotherFunc(25.3, "have a good day", "here's another string", 22) void Myfunc(int one,int two,string hello){ //todo: do something here } AnotherFunc(double dblone,string strGreeting,string strAnother, int param4) { //todo: do something here }
Can I pass this function off to a function that takes arbitrary functions that will get called later when some event occurs? You would have to have the variables set as global otherwise they would be out of scope. Global variables are highly frowned upon by the code
Sign in to your account