This documentation is archived and is not being maintained.

DirectorySearcher.Asynchronous Property

Gets or sets a value that indicates if the search is performed asynchronously.

Namespace: System.DirectoryServices
Assembly: System.DirectoryServices (in system.directoryservices.dll)

public bool Asynchronous { get; set; }
/** @property */
public boolean get_Asynchronous ()

/** @property */
public void set_Asynchronous (boolean value)

public function get Asynchronous () : boolean

public function set Asynchronous (value : boolean)

Not applicable.

Property Value

true if the search is asynchronous; false otherwise.

An asynchronous search can show results as they are found while simultaneously searching for additional results. This is useful for tasks such as populating list boxes.

The default setting for this property is false.

The following C# example shows how to create an asynchronous search.

using System.DirectoryServices;
// Bind to the users container.
DirectoryEntry entry = new DirectoryEntry("LDAP://CN=users,DC=fabrikam,DC=com");
// Create a DirectorySearcher object.
DirectorySearcher mySearcher = new DirectorySearcher(entry);
//Set the Asynchronous property to true.
src.Asynchronous = true;
//Use the FindAll method to get search results.
SearchResultCollection res = src.FindAll();

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0