Writes a subarray of characters to the text stream.
[Visual Basic] Overloads Overrides Public Sub Write( _ ByVal buffer() As Char, _ ByVal index As Integer, _ ByVal count As Integer _ ) [C#] public override void Write( char[] buffer, int index, int count ); [C++] public: override void Write( __wchar_t* buffer[], int index, int count ); [JScript] public override function Write( buffer : Char[], index : int, count : int );
Exception Type | Condition |
---|---|
ArgumentNullException | buffer is a null reference (in Visual Basic Nothing). |
ArgumentException | The buffer length minus index is less than count. |
ArgumentOutOfRangeException | index or count is negative. |
IOException | An I/O error occurs. |
StreamReader.Read (char[], int,
int) and StreamWriter.Write (char[], int, int) read and write the number of characters specified by the count parameter, while Stream.Read and Stream.Write read and write the number of bytes specified by the count parameter. Use the Stream methods only for reading and writing an integral number of byte arrays.
The characters are read from buffer beginning at index and ending at index + count. All characters are written to the underlying stream unless the end of the underlying stream is reached prematurely. Flush is invoked automatically if AutoFlush is true.
StreamWriter Class | StreamWriter Members | System.IO Namespace | StreamWriter.Write Overload List