Writes a block of bytes to the current stream using data read from buffer.
[Visual Basic] Overrides Public Function Write( _ ByVal buffer() As Byte, _ ByVal offset As Integer, _ ByVal count As Integer _ ) As Integer [C#] public override int Write( byte[] buffer, int offset, int count ); [C++] public: override int Write( unsigned char* buffer[], int offset, int count ); [JScript] public override function Write( buffer : Byte[], offset : int, count : int ) : int;
The number of bytes written.
Exception Type | Condition |
---|---|
ArgumentNullException | buffer is null. |
NotSupportedException | The stream does not support writing. |
ArgumentException | offset subtracted from the buffer length is less than count. |
ArgumentOutOfRangeException | offset or count are negative. |
The offset parameter gives the offset of the first byte in buffer to write from, and the count parameter gives the number of bytes to write. If the write operation is successful, the current position within the stream is advanced by the number of bytes written. If an exception occurs, the current position within the stream is unchanged.
MemoryStream Class | MemoryStream Members | System.IO Namespace