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 をオーバーライドします。

byte[] パラメーターを使用して構築された MemoryStream を除き、 MemoryStream の末尾に書き込み操作を実行すると、 MemoryStreamが展開されます。

適用対象

こちらもご覧ください