「C#」Download Files

- 第一种方法

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
namespace downloader_WebClient.DownloadFile
{
    class Program
    {
        static void Main(string[] args)
        {
            string URL = "http://ansbase5.info/vfm/vfm-admin/images/blog.jpg";
            string savename = @"x:\blog.jpg";

            WebClient mywebclient = new WebClient();
            mywebclient.DownloadFile(URL,savename);            
            Console.WriteLine(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);//打印当前文件名
            Console.ReadKey();
        }
    }
}

- 第二种 异步下载

aaaaa

猜你喜欢

转载自blog.csdn.net/iverson1180/article/details/80918056
今日推荐