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))
    count += 1
End While

備註

這個方法會覆寫 WriteByte

除了構造中帶有位元組[]參數外,將MemoryStream寫入在展開MemoryStream的末尾MemoryStream的操作。

適用於

另請參閱