public DownloadFileAsync ( System address, string fileName ) : void | ||
address | System | |
fileName | string | |
return | void |
using System; using System.Net; class Program { static void Main() { using (WebClient webClient = new WebClient()) { webClient.DownloadFile("https://example.com/myfile.txt", "myfile.txt"); } } }
using System; using System.Net; class Program { static void Main() { using (WebClient webClient = new WebClient()) { webClient.DownloadFileAsync(new Uri("https://example.com/myfile.txt"), "myfile.txt"); } } }This example downloads a file asynchronously using the DownloadFileAsync method. Package Library: The System.Net namespace is part of the .NET Framework, which means you don't need to install any additional packages or library to use the WebClient class.
public DownloadFileAsync ( System address, string fileName ) : void | ||
address | System | |
fileName | string | |
return | void |