MemoryStream.WriteByte(Byte) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将字节写入当前位置的当前流。
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
要写入的字节。
例外
当前流已关闭。
示例
该代码示例是 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写入操作。