I have 3 functions. They can be called in any order (later they may need specific order).
The return value of one function should be the first param of the next. How do i do this? what i am thinking is something like the below. Whats the best way to do this?
string void fn(string sz, data d, eventhdl nextFunc)
{
//do stuff
if(nextFunc == null)
return ret;
else
return nextFunc(ret, d, nextFunc.Next);
}
You need multiple methods to participate in a single request. Order matters. I think you might have yourself a Decorator pattern in your problem. It’s hard to tell working backward from implementation, though. It might be a Chain of Responsibility if you are trying to route a request to the right function.