title: Infinite while loop with Form application C#
body: <p>I need to run an infinite while loop when a form application starts. A form starts like this:</p>
  
  <pre><code>public Form1()
  {
          InitializeComponent();
  }
  </code></pre>
  
  <p>Now I want to run another function which will have an infinite loop inside with one second sleep time:</p>
  
  <pre><code>public void doProcess(){
  
      while(true){
           Thread.Sleep(1000);
           // other task
      }
  }
  </code></pre>
  
  <p>How can I do this? When I call <code>doProcess()</code> in the constructor, it does not show the form. I tried to run the while loop for 10 iterations. The form showed up only after all the iterations are finished. I don't understand why it is happening.</p>