MemoryStream.CopyTo(Stream, Int32) 方法

定義

使用指定的緩衝區大小,從目前記憶體資料流讀取位元組,並將其寫入至另一個資料流。

public:
 override void CopyTo(System::IO::Stream ^ destination, int bufferSize);
public override void CopyTo (System.IO.Stream destination, int bufferSize);
override this.CopyTo : System.IO.Stream * int -> unit
Public Overrides Sub CopyTo (destination As Stream, bufferSize As Integer)

參數

destination
Stream

要將目前記憶體資料流內容複製到其中的資料流。

bufferSize
Int32

緩衝區的大小。 這個值必須大於零。 預設大小為 81920。

例外狀況

destinationnull

bufferSize 不是正數。

基礎記憶體資料流或 destination 資料流已關閉。

無法讀取基礎記憶體資料流。

-或-

無法寫入 destination 資料流。

適用於