public List <ILdapEntry> GetEntries() { int numberEntries = LdapClientLibrary.ldap_count_entries(this._connection.GetIntPtr(), this._message); List <ILdapEntry> entryList = new List <ILdapEntry>(numberEntries); if (numberEntries > 0) { try { IntPtr pEntry = LdapClientLibrary.ldap_first_entry(this._connection.GetIntPtr(), this._message); while ((pEntry != null) && (pEntry != IntPtr.Zero)) { entryList.Add(new LdapEntry(this, pEntry)); pEntry = LdapClientLibrary.ldap_next_entry(this._connection.GetIntPtr(), pEntry); } } catch (Exception exception) { throw exception; } } return(entryList); }