How can I define a function that expects another function that returns a bool in c#?
To clarify, this is what I'd like to do using C++:
void Execute(boost::function<int(void)> fctn)
{
if(fctn() != 0)
{
show_error();
}
}
int doSomething(int);
int doSomethingElse(int, string);
int main(int argc, char *argv[])
{
Execute(boost::bind(&doSomething, 12));
Execute(boost::bind(&doSomethingElse, 12, "Hello"));
}
In my example above the Execute function in combination is with the bind gets the expected result.
Background:
I've got a bunch of functions, each returning a int but with different parameter count that are surrounded by the same error checking code. A huge code duplication I want to avoid...