When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
Type Reason ArgumentException (offset + count ) is greater than the length of buffer. ArgumentNullException buffer is null. ArgumentOutOfRangeException offset or count is negative. System.IO.IOException An I/O error occurred. NotSupportedException The stream does not support writing. ObjectDisposedException The stream is closed.
If the write operation is successful, the position within the stream advances by the number of bytes written. If an exception occurs, the position within the stream remains unchanged.