MemoryStream.WriteByte(Byte) 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将一个字节写入当前位置上的当前流。
public:
override void WriteByte(System::Byte value);
C#
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++ ] );
}
C#
// 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
使用 byte[] 参数构造的 ,在 末尾的 MemoryStream
写入操作将展开 MemoryStream
。
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |