I’m trying to pass a reference to a function as a parameter
It’s hard to explain
I’ll write some example pseudo code
(calling function)
function(hello());
function(pass)
{
if this = 0 then pass
else
}
hello()
{
do something here
}
Sorry if it does not make much sense
But I’m trying to reduce used code and I thought this would be a good idea.
How can I do this in C#?
You can pass code to a method by using delegates, for example, the Action delegate:
Usage: