How to pause execution and wait for an event to occur?
<p>Is there a way to pause execution of one method and wait until an event occurs?<br>
As far as I know, I can't do something like:</p>

<pre><code>    EventWaiter ew = new EventWaiter();
    ew.WaitForEvent(button1.Click);
</code></pre>

<p>I heard that I can pause a whole thread, but that's not exactly what I need.<br>
Everything <strong>must stay in one void</strong>, and it would be nice if it'd stay in one thread.  </p>

<p>For example, Console.ReadLine() pauses the execution. If Microsoft did it, why can't I?<br>
I guess that's not an infinite loop, since my CPU usage remains less than 100%.  </p>

<p><strong>EDIT:</strong><br>
This code is similar to one in my application, which would contain the "EventWaiter":</p>

<pre><code>    public string ReturnInput()
    {
    EventWaiter ew = new EventWaiter();
    ew.WaitForEvent(confirmButton.Click);
    return inputTextBox.Text;
    }
</code></pre>
