C# MonoDevelopandroid下载文件
我正在使用MonoDevelop for Android,希望您能帮助我从URL轻松下载一个文件,然后将其保存到一个文件中。我已经看过很多Java版本的这个动作,但是如果可能的话,我想要一些C代码 提前谢谢。请查看 文件样本:C# MonoDevelopandroid下载文件,c#,android,save,download,monodevelop,C#,Android,Save,Download,Monodevelop,我正在使用MonoDevelop for Android,希望您能帮助我从URL轻松下载一个文件,然后将其保存到一个文件中。我已经看过很多Java版本的这个动作,但是如果可能的话,我想要一些C代码 提前谢谢。请查看 文件样本: string remoteUri = "http://www.contoso.com/library/homepage/images/"; string fileName = "ms-banner.gif", myStringWebResource = null; //
string remoteUri = "http://www.contoso.com/library/homepage/images/";
string fileName = "ms-banner.gif", myStringWebResource = null;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Concatenate the domain with the Web resource filename.
myStringWebResource = remoteUri + fileName;
Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(myStringWebResource,fileName);
Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + Application.StartupPath);