There is an interesting post over here about this, in relation to cross-application flow of control.
Well, recently, I\'ve come across an interesting problem. Gener
walk_r should simply return the value when it is hit. It's is a pretty standard recursion example. The only potential problem I see is that you said it is potentially endless, which will have to be compensated for in the walk_r code by keeping count of the recursion depth and stopping at some maximum value.
The exception actually makes the coding very strange since the method call now throws an exception to return the value, instead of simply returning 'normally'.
try
{
Walk_r(tree);
}
catch (SuccessException ex)
{
result = ex.Value;
}
becomes
result = Walk_r(tree);