How to pause / resume a thread in C#

Here is the code snippet which will help you to pause / resume a thread using ManualResetEvent class. Both Suspend() and Resume() methods are deprecated in .Net Framework. So both of these methods not recommended to use.

private ManualResetEvent _manualResetEvent = new ManualResetEvent(true);

var thread = new Thread(() =>
{
    while (true)
    {
        //Do the work here
        _manualResetEvent.WaitOne(Timeout.Infinite);
    }
});

And to pause the thread, you can use

_manualResetEvent.Reset();

And to resume you can use

_manualResetEvent.Set();

You can find more details about ManualResetEvent in MSDN

Happy Programming.