MemoryStream.WriteByte(Byte) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes a byte to the current stream at the current position.
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)
Parameters
- value
- Byte
The byte to write.
Exceptions
The stream does not support writing. For additional information see CanWrite.
-or-
The current position is at the end of the stream, and the capacity cannot be modified.
The current stream is closed.
Examples
This code example is part of a larger example provided for the MemoryStream class.
// 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
Remarks
This method overrides WriteByte.
Except for a MemoryStream
constructed with a byte[] parameter, write operations at the end of a MemoryStream
expand the MemoryStream
.