Bewerken

Delen via


MemoryStream.EndRead(IAsyncResult) Method

Definition

Waits for the pending asynchronous read to complete. (Consider using ReadAsync(Byte[], Int32, Int32, CancellationToken) instead.)

public:
 override int EndRead(IAsyncResult ^ asyncResult);
public override int EndRead (IAsyncResult asyncResult);
override this.EndRead : IAsyncResult -> int
Public Overrides Function EndRead (asyncResult As IAsyncResult) As Integer

Parameters

asyncResult
IAsyncResult

The reference to the pending asynchronous request to finish.

Returns

The number of bytes read from the memory stream, between zero (0) and the number of bytes you requested. Returns zero (0) only at the end of the memory stream, otherwise, it should block until at least one byte is available.

Exceptions

asyncResult is null.

A handle to the pending read operation is not available.

-or-

The pending operation does not support reading.

asyncResult did not originate from a BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) method on the current memory stream.

The stream is closed or an internal error has occurred.

Remarks

Refer to the EndRead remarks for additional usage information for this method.

Applies to