DirectorySearcher.Asynchronous 属性

定义

获取或设置一个值,该值指示是否异步执行搜索。

public:
 property bool Asynchronous { bool get(); void set(bool value); };
public bool Asynchronous { get; set; }
[System.DirectoryServices.DSDescription("DSAsynchronous")]
[System.Runtime.InteropServices.ComVisible(false)]
public bool Asynchronous { get; set; }
member this.Asynchronous : bool with get, set
[<System.DirectoryServices.DSDescription("DSAsynchronous")>]
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.Asynchronous : bool with get, set
Public Property Asynchronous As Boolean

属性值

true 如果搜索是异步的,则为 false 否则。

属性

示例

以下 C# 示例演示如何创建异步搜索。

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

注解

异步搜索可以在同时搜索其他结果时显示结果。 这对于填充列表框等任务非常有用。

此属性的默认设置为 false

适用于