共用方式為


GZipStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) 方法

定義

開始非同步的寫入作業。 (請考慮使用 WriteAsync(Byte[], Int32, Int32) 方法替代。)

public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ array, int offset, int count, AsyncCallback ^ asyncCallback, System::Object ^ asyncState);
public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ buffer, int offset, int count, AsyncCallback ^ asyncCallback, System::Object ^ asyncState);
public override IAsyncResult BeginWrite (byte[] array, int offset, int count, AsyncCallback? asyncCallback, object? asyncState);
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object? asyncState);
public override IAsyncResult BeginWrite (byte[] array, int offset, int count, AsyncCallback asyncCallback, object asyncState);
override this.BeginWrite : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
override this.BeginWrite : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
Public Overrides Function BeginWrite (array As Byte(), offset As Integer, count As Integer, asyncCallback As AsyncCallback, asyncState As Object) As IAsyncResult
Public Overrides Function BeginWrite (buffer As Byte(), offset As Integer, count As Integer, asyncCallback As AsyncCallback, asyncState As Object) As IAsyncResult

參數

arraybuffer
Byte[]

包含要寫入目前資料流之資料的緩衝區。

offset
Int32

要開始寫入的位元組位移。

count
Int32

寫入的最大位元組數。

asyncCallback
AsyncCallback

選擇性的非同步回呼,會在寫入作業完成時呼叫。

asyncState
Object

使用者所提供的物件,其可以從其他要求中區分出這個特定非同步寫入的要求。

傳回

表示可能仍為暫止狀態的非同步寫入作業之物件。

例外狀況

基礎資料流為 null

-或-

已關閉基礎資料流。

備註

從 .NET Framework 4.5 開始,您可以使用 方法來執行異步寫入作業Stream.WriteAsync。 此方法 BeginWrite 仍可在目前的版本中使用,以支援舊版程式代碼;不過,您可以使用新的異步方法,更輕鬆地實作異步 I/O 作業。 如需詳細資訊,請參閱非同步檔案 I/O

方法 BeginWrite 會啟動對數據流物件的異步寫入作業 GZipStream

您必須建立回呼方法,以實作 AsyncCallback 委派,並將其名稱傳遞至 BeginWrite 方法。

適用於