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

System.IO.FileStream.EndRead Method

Ends a pending asynchronous read request, and blocks until the read request has completed.

public override int EndRead (IAsyncResult asyncResult)

Parameters

asyncResult
The IAsyncResult object for the pending asynchronous request.

Returns

A int containing the number of bytes read from the stream. Returns 0 only if the end of the file has been reached, otherwise, this method blocks until at least one byte is available.

Exceptions

TypeReason
ArgumentNullExceptionasyncResult is null.
ArgumentExceptionasyncResult was not returned by a call to FileStream.BeginRead(Byte[], int, int, AsyncCallback, object).
InvalidOperationExceptionFileStream.EndRead(IAsyncResult) was called multiple times with asyncResult .

Remarks

EndRead will block until the I/O operation has completed.

Note: This method overrides Stream.EndRead(IAsyncResult).

Requirements

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