Windows phone 7 询问Windowsphone 7中的webClient
我正在尝试为我的手机创建一个简单的应用程序,可以从网站获取数据并保存到手机上。在我查找之后,我知道我必须为此应用程序使用webClient。当我编写代码时,我遇到了为类中的属性设置值的问题Windows phone 7 询问Windowsphone 7中的webClient,windows-phone-7,webclient,Windows Phone 7,Webclient,我正在尝试为我的手机创建一个简单的应用程序,可以从网站获取数据并保存到手机上。在我查找之后,我知道我必须为此应用程序使用webClient。当我编写代码时,我遇到了为类中的属性设置值的问题 class data { public string temp = ""; public void getContent(string url) { var client = new WebClient(); client.DownloadStringC
class data
{
public string temp = "";
public void getContent(string url)
{
var client = new WebClient();
client.DownloadStringCompleted += (s, e) => { /*my problem is right here*/};
client.DownloadStringAsync(new Uri(url));
}
}
例如:e.result=“这是一本书”,那么如何设置“temp”的“e.result”?只要替换即可
client.DownloadStringCompleted += (s, e) => { /*my problem is right here*/};
与
client.DownloadStringCompleted += (s, e) => {
temp = e.Result;
};