DownloadProgressChangedEventArgs::BytesReceived Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the number of bytes received.

Namespace:   System.Net
Assembly:  System (in System.dll)

public:
property long long BytesReceived {
	long long get();
}

Property Value

Type: System::Int64

An Int64 value that indicates the number of bytes received.

To determine what percentage of the transfer has occurred, use the ProgressPercentage property.

The following code example shows an implementation of a handler for the DownloadProgressChanged event. The method displays the value of this property.

static void UploadProgressCallback(Object^ sender, 
          UploadProgressChangedEventArgs^ e)
      {
          // Displays the operation identifier, and the transfer progress.
          Console::WriteLine("{0}    uploaded {1} of {2} bytes. {3} % complete...", 
              (String ^)e->UserState, 
              e->BytesSent, 
              e->TotalBytesToSend,
              e->ProgressPercentage);
      }
static void DownloadProgressCallback(Object^ sender, 
          DownloadProgressChangedEventArgs^ e)
      {
          // Displays the operation identifier, and the transfer progress.
          Console::WriteLine("{0}    downloaded {1} of {2} bytes. {3} % complete...", 
              (String ^)e->UserState, 
              e->BytesReceived, 
              e->TotalBytesToReceive,
              e->ProgressPercentage);
      }

.NET Framework
Available since 2.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: