title: How to skip a record in a Foreach
body: <p>I am trying to create an object from an Active Directory base on a simple login. The problem is that some of the login information is valid.</p>
  
  <p>How could I just use a try-catch so that if an exception is thrown, just skip to the next login?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>foreach (var PharosUserItem in ListRef)
  {
      ADUser User;
      try
      {
          User = new ADUser(PharosUserItem.UserLoginPharos);
      }
      catch (ByTel.DirectoryServices.Exceptions.UserNotFoundException ex)
      {
          break;
      }
  }
  </code></pre>
  
  <p>The break gets me out of the <code>foreach</code>, which is not what I want. Any ideas?</p>