The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
OpenReadCompletedEventHandler Delegate
Visual Studio 2010
Represents the method that will handle the OpenReadCompleted event of a WebClient.
Assembly: System (in System.dll)
public delegate void OpenReadCompletedEventHandler( Object sender, OpenReadCompletedEventArgs e )
Parameters
- sender
- Type: System.Object
The source of the event.
- e
- Type: System.Net.OpenReadCompletedEventArgs
A OpenReadCompletedEventArgs containing event data.
The following code example demonstrates downloading a resource for reading.
The following method is called when the download completes.
private static void OpenReadCallback2 (Object sender, OpenReadCompletedEventArgs e)
{
Stream reply = null;
StreamReader s = null;
try
{
reply = (Stream)e.Result;
s = new StreamReader (reply);
Console.WriteLine (s.ReadToEnd ());
}
finally
{
if (s != null)
{
s.Close ();
}
if (reply != null)
{
reply.Close ();
}
}
}
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Community Additions
Show: