I am trying to do a very large recursive operation, but it just hangs up. IS there any way of pausing t for some time, then make it continue?

Thanks in advance.

This System.Threading.Thread.Sleep(100); makes your code to wait for 100 ms. But it doesn't yield CPU time to other threads if that's what you want. Use Application.DoEvents(); to yield some CPU time to other threads as well.

You may also use both together:


but I would try to avoid recursion in the first place and use BackgroundWorker if possible.


Every recursive operation has to have some kind of stopping condition.
If not, you can create a stack overflow or some other error.
Look at the classic example of the factorial calculation:

uint factorial(unint n) 
     if (n <= 1) {
          return 1; // stopping condition
     } else {
          return n * factorial(n-1);