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

除了使用 byte[] 参数构造的MemoryStream构造外,在展开MemoryStream的末尾MemoryStream写入操作。

适用于

另请参阅