EndRead Method
See Also 
SourceCode.IO Namespace > ProtectedStream Class : EndRead Method



asyncResult
The reference to the pending asynchronous request to finish.

Glossary Item Box

Waits for the pending asynchronous read to complete. (Consider using System.IO.Stream.ReadAsync(System.Byte[],System.Int32,System.Int32) instead; see the Remarks section.)

Syntax

Visual Basic (Declaration) 
Public Overrides Function EndRead( _
   ByVal asyncResult As IAsyncResult _
) As Integer
Visual Basic (Usage)Copy Code
Dim instance As ProtectedStream
Dim asyncResult As IAsyncResult
Dim value As Integer
 
value = instance.EndRead(asyncResult)
C# 
public override int EndRead( 
   IAsyncResult asyncResult
)
C++/CLI 
public:
int EndRead( 
   IAsyncResult^ asyncResult
) override 

Parameters

asyncResult
The reference to the pending asynchronous request to finish.

Return Value

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

Exceptions

ExceptionDescription
System.ArgumentNullExceptionasyncResult is null.
System.ArgumentExceptionA handle to the pending read operation is not available.-or-The pending operation does not support reading.
System.InvalidOperationExceptionasyncResult did not originate from a System.IO.Stream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object) method on the current stream.
System.IO.IOExceptionThe stream is closed or an internal error has occurred.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also