title: Difference between PrincipalSearcher and DirectorySearcher
body: <p>I see Active Directory examples that use <code>PrincipalSearcher</code> and other examples that do the same thing but use <code>DirectorySearcher</code>. What is the difference between these two examples? </p>
  
  <p>Example using <code>PrincipalSearcher</code></p>
  
  <pre><code>PrincipalContext context = new PrincipalContext(ContextType.Domain);
  PrincipalSearcher search = new PrincipalSearcher(new UserPrincipal(context));
  foreach( UserPrincipal user in search.FindAll() )
  {
      if( null != user )
          Console.WriteLine(user.DistinguishedName);
  }
  </code></pre>
  
  <p>Example using <code>DirectorySearcher</code></p>
  
  <pre><code>DirectorySearcher search = new DirectorySearcher("(&amp;(objectClass=user)(objectCategory=person))");
  search.PageSize = 1000;
  foreach( SearchResult result in search.FindAll() )
  {
      DirectoryEntry user = result.GetDirectoryEntry();
      if( null != user )
          Console.WriteLine(user.Properties["distinguishedName"].Value.ToString());
  }
  </code></pre>