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,否則為 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介面實施者都不會使用這個屬性, 而且false應該會傳回。Most implementers of the IAsyncResult interface will not use this property and should return false. 從開始FromAsync(IAsyncResult, Action<IAsyncResult>, TaskCreationOptions) , 如果未正確執行這個屬性, 則使用方法建立的工作將不會完成。 .NET Framework 4.5.NET Framework 4.5Beginning 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. 例如, 如果 i/o 要求很小true , 則此屬性可能會傳回非同步 i/o 作業的。For example, this property can return true for an asynchronous I/O operation if the I/O request was small.

適用於