PipeStream.EndRead(IAsyncResult) 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
結束擱置的非同步讀取要求。
public:
override int EndRead(IAsyncResult ^ asyncResult);
C#
public override int EndRead (IAsyncResult asyncResult);
C#
[System.Security.SecurityCritical]
public override int EndRead (IAsyncResult asyncResult);
override this.EndRead : IAsyncResult -> int
[<System.Security.SecurityCritical>]
override this.EndRead : IAsyncResult -> int
Public Overrides Function EndRead (asyncResult As IAsyncResult) As Integer
- asyncResult
- IAsyncResult
暫止之非同步要求的參考。
已讀取的位元組數目。 傳回值 0 表示資料流末端 (管道已經關閉)。
- 屬性
asyncResult
為 null
。
asyncResult
不是來自目前資料流的 BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) 方法。
資料流已關閉或發生內部錯誤。
此方法返回先前調用BeginRead所指定的字節數組中讀取的字節數。
將傳 IAsyncResult 回的對象傳遞至 EndRead 方法,以判斷已讀取的位元元組數目,以及釋放用於讀取的作業系統資源。 EndRead 每次呼叫 BeginRead都必須呼叫一次。 這可以在呼叫 BeginRead 的相同程序代碼中完成,或在傳遞至 BeginRead的回呼中完成。
CanRead使用屬性來判斷目前PipeStream物件是否支援讀取作業。
如果管道已關閉或傳遞無效的自變數, BeginRead則會立即引發適當的例外狀況。 異步讀取要求期間發生的錯誤發生在執行要求的線程集區線程上。 當程式代碼呼叫 EndRead 方法時,就會引發例外狀況。
產品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |