title: Call a method n number of times
body: <pre><code>int noOfAttempts = 3;
  void StartServer();
  bool IsServerRunning();
  </code></pre>
  
  <p>I need to re-attempt <code>StartServer()</code> 3 times based on result from <code>IsServerRunnig()</code>. Something like this:</p>
  
  <pre><code>StartServer();
  if (!IsServerRunning())
  {
      StartServer();
      if (!IsServerRunning())
      {
          StartServer();
          if (!IsServerRunning())
          {
              StartServer();
          }
      }
  }
  </code></pre>
  
  <p>I don't want to use for loops or the ugly code like above. Is there a better way of doing this? A way in which, I won't have to change my code if <code>noOfAttempts</code> change in future?</p>
  
  <p>EDIT:
  <strong>I'm expecting something from the "delegate" concept (If possible).</strong></p>