MemoryStream.WriteByte(Byte) 方法

定義

寫入位元組至資料流目前位置。

public:
 override void WriteByte(System::Byte value);
public override void WriteByte (byte value);
override this.WriteByte : byte -> unit
Public Overrides Sub WriteByte (value As Byte)

參數

value
Byte

要寫入的位元組。

例外狀況

資料流不支援寫入。 如需詳細資訊,請參閱 CanWrite

-或- 目前的位置在資料流結尾,並且無法修改容量。

目前的資料流已關閉。

範例

此程式碼範例是提供給 類別之較大範例的 MemoryStream 一部分。

// Write the second string to the stream, byte by byte.
count = 0;
while ( count < secondString->Length )
{
   memStream->WriteByte( secondString[ count++ ] );
}
// Write the second string to the stream, byte by byte.
count = 0;
while(count < secondString.Length)
{
    memStream.WriteByte(secondString[count++]);
}
' Write the second string to the stream, byte by byte.
count = 0
While(count < secondString.Length)
    memStream.WriteByte(secondString(count))
    count += 1
End While

備註

這個方法會覆寫 WriteByte

MemoryStream除了使用 byte[] 參數建構的 之外,在 展開 MemoryStream 結尾的 MemoryStream 寫入作業。

適用於

另請參閱