title: Adding multiple criteria to LDAP searches
body: <p>I have functioning example code to query all users that match a certain department number and echo all associated LDAP properties for each user:</p>
  
  <pre><code>string attribute = "departmentnumber";
  string value = "123";
  
  DirectoryEntry rootEntry = new DirectoryEntry("LDAP://ldap.acme.com:389");
  rootEntry.AuthenticationType = AuthenticationTypes.None;
  
  DirectorySearcher searcher = new DirectorySearcher(rootEntry, $"({attribute}={value})");
  
  SearchResultCollection results = searcher.FindAll();
  
  foreach (SearchResult result in searcher.FindAll())
  {
      var allLDAPProperties = result.Properties.PropertyNames;
  
      foreach (var property in allLDAPProperties)
      {
          Console.WriteLine((result.Properties[property.ToString()].Count &gt; 0 ? result.Properties[property.ToString()][0] : string.Empty).ToString());
      }
  
      Console.WriteLine(Environment.NewLine);
  }
  
  Console.ReadKey();
  </code></pre>
  
  <p>However, I would like to add multiple criterion to my initial search (e.g. Return all users with a "departmentnumber" attribute matching "123" and a "joblevel" attribute matching "5." I'm unable to find the correct way to supply compound filter criteria to <code>DirectorySearcher</code>.</p>
  
  <p>I know I could filter the initial result set down with additional processing in a <code>foreach</code> loop, but I'm trying to be efficient.</p>