IAsyncResult.CompletedSynchronously 属性
定义
获取一个值,该值指示异步操作是否同步完成。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;否则为 false。true 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 将不会使用此属性,并且应返回 false 。Most implementers of the IAsyncResult interface will not use this property and should return false. 从 .NET Framework 4.5 开始, FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) 如果未正确实现此属性,则使用方法创建的任务将无法完成。Beginning with the .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.