NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Stream.Write

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

[Visual Basic]
Overridable Public Function Write( _
   ByVal buffer() As Byte, _
   ByVal offset As Integer, _
   ByVal count As Integer _
) As Integer
[C#]
public virtual int Write(
   byte[] buffer,
   int offset,
   int count
);
[C++]
public: virtual int Write(
   unsigned char* buffer[],
   int offset,
   int count
);
[JScript]
public function Write(
   buffer : Byte[],
   offset : int,
   count : int
) : int;

Parameters

buffer
An array of bytes. This method copies count bytes from buffer to the current stream.
offset
The byte offset in buffer at which to begin copying bytes to the current stream.
count
The number of bytes to be written to the current stream.

Return Value

The total number of bytes written to the stream.

Exceptions

Exception Type Condition
ArgumentException The result of offset subtracted from the buffer length is less than count.
ArgumentNullException buffer is null.
ArgumentOutOfRangeException offset or count is negative.
IOException An I/O error occurs.
NotSupportedException The stream does not support writing.

Remarks

The default implementation calls the asynchronous BeginWrite method.

Implementations of this method copy count bytes to this stream from buffer beginning at offset. 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.

Use BinaryWriter for writing primitive data types.

See Also

Stream Class | Stream Members | System.IO Namespace