By now I'm having this code
public void getRankingList(string country,string type)
{
WebClient client = new WebClient();
client.AllowReadStreamBuffering = true;
string url = "......";
client.DownloadStringCompleted += getRankingResult;
client.DownloadStringAsync(new Uri(url, UriKind.Absolute));
}
private void getRankingResult(object sender, DownloadStringCompletedEventArgs e)
{
.........
}
So now can I add some para to the downloadCompleted event ? something like:
private void getRankingResult(object sender, DownloadStringCompletedEventArgs e, string Para)
{
.........
}
public void getRankingList(string country,string type)
{
WebClient client = new WebClient();
client.AllowReadStreamBuffering = true;
string url = "......";
client.DownloadStringCompleted += (sender, args) =>
getRankingResult(sender, args, "para");
client.DownloadStringAsync(new Uri(url, UriKind.Absolute));
}
private void getRankingResult(object sender, DownloadStringCompletedEventArgs e, string Para)
{
// .....
}
如果DownloadStringCompletedEventArgs
不是密封类,那么您可以创建一个新类并从中继承并向其添加附加string Para
字段。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.