Share via


Stream.Read Method

When overridden in a derived class, this method reads a sequence of bytes from the current Stream object and advances the position within the stream by the number of bytes tbat are read.

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)

Syntax

public virtual abstract int Read (
         byte[] buffer,
         intoffset,
         intcount
)

Parameters

  • buffer
    An array of bytes. When this method returns a value, the buffer contains the specified byte array that includes the values from the offset parameter through (offset + count - 1) replaced by the bytes read from the current source.
  • offset
    The 0-based byte offset in the buffer parameter at which you want to begin storing the data that is read from the current stream.
  • count
    The maximum number of bytes to be read from the current stream.

Return Value

The total number of bytes that are read into the buffer. This can be less than the number of bytes requested, if that many bytes are not currently available. Note that the return value is 0 (zero) if the end of the stream has been reached.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

Stream Class
Stream Members
System.IO Namespace