IAsyncResult.CompletedSynchronously IAsyncResult.CompletedSynchronously IAsyncResult.CompletedSynchronously IAsyncResult.CompletedSynchronously Property

定义

获取一个值,该值指示异步操作是否同步完成。Gets a value that indicates whether the asynchronous operation completed synchronously.

public:
 property bool CompletedSynchronously { bool get(); };
public bool CompletedSynchronously { get; }
member this.CompletedSynchronously : bool
Public ReadOnly Property CompletedSynchronously As Boolean

属性值

如果异步操作同步完成,则为 true;否则为 falsetrue if the asynchronous operation completed synchronously; otherwise, false.

注解

如果在调用同步完成中检测到AsyncCallback很可能启动异步操作的线程是当前线程的委托。If the synchronous completion of the call is detected in the AsyncCallback delegate, it is probable that the thread that initiated the asynchronous operation is the current thread.

实施者说明

大多数的实施者IAsyncResult接口将不使用此属性,并应返回falseMost implementers of the IAsyncResult interface will not use this property and should return false. 开头.NET Framework 4.5.NET Framework 4.5,使用创建的任务FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions)方法将无法完成,如果此属性的实现不正确。Beginning with the .NET Framework 4.5.NET Framework 4.5, a task that is created with the FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) method will not complete if this property is not implemented correctly. 请参阅4.5 中的应用程序兼容性See Application Compatibility in 4.5.

调用方说明

使用此属性以确定异步操作以同步方式完成。Use this property to determine if the asynchronous operation completed synchronously. 例如,此属性可返回true如果是小型 I/O 请求的异步 I/O 操作。For example, this property can return true for an asynchronous I/O operation if the I/O request was small.

适用于