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写入操作。

适用于

另请参阅