Mono Class Library: System.IO.FileStream Overview | Members

System.IO.FileStream.Write Method

Writes a block of bytes from a specified byte array to the current stream. [Edit]

public override void Write (byte[] array, int offset, int count)

Parameters

array
The byte array to read. [Edit]
offset
A int that specifies the byte offset in array at which to begin reading. [Edit]
count
A int that specifies the maximum number of bytes to write to the current stream. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionarray is null. [Edit]
ArgumentExceptionoffset + count is greater than the length of array. [Edit]
ArgumentOutOfRangeExceptionoffset or count is negative. [Edit]
System.IO.IOExceptionAn I/O error occurred. [Edit]
NotSupportedExceptionThe current stream does not support writing. [Edit]
ObjectDisposedExceptionAn I/O error occurred. [Edit]

Remarks

If the write operation is successful, the current position of the stream is advanced by the number of bytes written. If an exception occurs, the current position of the stream is unchanged.

Note:

Use the FileStream.CanWrite property to determine whether the current instance supports writing. For additional information, see Stream.CanWrite.

This method overrides Stream.Write(Byte[], int, int).

[Edit]

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0