title: How can I retrieve a complete list of Attributes for a class in an LDAP repository with .NET?
body: <p>I have an application that reads user records from an LDAP repository. I'm using the facilities in the System.DirectoryServices.Protocols namespace to do so. The objectclass is typically person or inetOrgPerson.</p>
  
  <p>How can I dynamically read the attributes for a given class from the LDAP repository?</p>
  
  <p>The following code produces a list of attributes for a sample user in the repository, but appears to only return those attributes that have values.</p>
  
  <pre><code>var connection = new LdapConnection(...);
  SearchRequest request = new SearchRequest("CN=joe.user,DC=blah,DC=com", (string)null, SearchScope.Base);
  SearchResponse response = (SearchResponse)connection.SendRequest(request);
  
  var attributes = new List&lt;string&gt;();
  foreach (SearchResultEntry entry in response.Entries)
  {
      foreach (string attributeName in entry.Attributes.AttributeNames)
          attributes.Add(attributeName);
  }
  </code></pre>
  
  <p>I can red the objectclass attribute from a sample user to get the classes, but then how would I retrieve all attributes for the user's objectclass list?</p>
  
  <p>NOTE: the SearchRequest class claims that setting the Attributes property to null will return all attributes. Unfortunately there is no setter for this property!</p>
  
  <p>NOTE 2: I've tried adding "*" and "+" to the list of attribute names to no avail.</p>