Are there any general rules when using recursion on how to avoid stackoverflows?
How many times you will be able to recurse will depend on:
Guid
local variables will be take more stack than a method which doesn't have any local variables, for example)How to avoid stack overflows? Don't recurse too far :) If you can't be reasonably sure that your recursion will terminate without going very far (I'd be worried at "more than 10" although that's very safe) then rewrite it to avoid recursion.