Wait until the timer ticks specific number of times
<p>I'm trying to make my program do nothing until my timer ticks twice (2 seconds in total). 
I'm using the following code, and the timer won't work unless I take out the while statement. </p>

<pre><code>timer = 0;
Console.WriteLine("timer start ");
timer1.Start();
while (timer &lt; 2);
Console.WriteLine("timer ends");

private void timer1_Tick(object sender, EventArgs e)
{
    Console.WriteLine(timer);
    timer++;
}
</code></pre>
