SearchResultCollection
The SearchResultCollection class contains the SearchResult instances that the Active Directory hierarchy returned during a DirectorySearcher query.
The SearchResultCollection class is derived from the System.MarshalByRefObject class.
Public Methods
The SearchResultCollection class has the following public methods.
Method | Description |
---|---|
Contains(SearchResult) | Determines if a specified SearchResult object is in this collection. |
CopyTo(SearchResult[], Int32) | Copies the SearchResult objects from this collection to an array, starting at a particular index of the array. |
CreateObjRef(Type) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. |
Dispose() | Overloaded. Releases the resources used by the SearchResultCollection. |
Equals(Object) | Determines whether the specified Object is equal to the current Object. |
GetEnumerator() | Returns an enumerator that you can use to iterate through this collection. |
GetHashCode() | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. |
GetLifetimeService() | Retrieves the current lifetime service object that controls the lifetime policy for this instance. |
GetType() | Gets the Type of the current instance. |
IndexOf(SearchResult) | Retrieves the index of a specified SearchResult object in this collection. |
InitializeLifetimeService() | Obtains a lifetime service object to control the lifetime policy for this instance. |
ToString() |
Public Properties
The SearchResultCollection class has the following public properties.
Property | Description |
---|---|
Count | Data type: Int32 Access type: Read-only Gets the number of SearchResult objects in this collection. |
Handle | Data type: IntPtr Access type: Read-only Gets the handle returned by IDirectorySearch::ExecuteSearch, which was called by DirectorySearcher that created this collection. |
Item | Data type: SearchResult Access type: Read-only Gets the SearchResult object that is located at a specified index in this collection. In C#, this property is the indexer for the SearchResultCollection class. |
PropertiesLoaded | Data type: String array Access type: Read-only Gets the DirectorySearcher properties that were specified before the search was executed. |
Protected Methods
The SearchResultCollection class has the following protected methods.
Method | Description |
---|---|
Dispose(Boolean) | Overloaded. Releases the resources used by the SearchResultCollection. |
Finalize() | Overridden. Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. In C# and C++, finalizers are expressed using destructor syntax. |
MemberwiseClone() | Creates a shallow copy of the current Object. |
Security
Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code.
Remarks
Each time that a query is performed, SearchResultCollection holds a handle. This handle corresponds to the search handle in ADSI. This handle persists until you call the Dispose method on the SearchResultCollection object, so you must call Dispose to prevent a memory leak. The garbage collector does not free memory for this particular object.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Requirements
Client | Requires Windows XP Home Edition, Windows XP Professional, Windows Me, or Windows 98. |
Server | Requires Windows Server 2003, Windows 2000, or Windows NT 4.0. |
Namespace | Defined in System.DirectoryServices. |
Assembly | Requires System.DirectoryServices (in System.DirectoryServices.dll). |
.NET Framework | Requires .NET Framework 1.0. |
See Also
System.DirectoryServices Namespace, Managed Extensions for C++ Programming