Pankaj Mishra
Pankaj Mishra

Reputation: 20348

How can I pause execution of a C#.NET program?

I have Desktop Application There is a button Pause. I want to pause Program on button click. I am using Thread. Thread.suspend is not working Please give me idea to solve this.

Upvotes: 1

Views: 2475

Answers (1)

Stephen Fischer
Stephen Fischer

Reputation: 2546

This will pause the thread that called it until is_paused is false. This what you need?

while(is_paused)
    Thread.Sleep(sleep_time);

Upvotes: 1

Related Questions