到目前为止,我正在使用此代码
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)
{
.........
}
所以现在可以在downloadCompleted事件中添加一些para吗?类似的东西:
private void getRankingResult(object sender, DownloadStringCompletedEventArgs e, string Para)
{
.........
}
答案 0 :(得分:4)
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)
{
// .....
}
答案 1 :(得分:1)
如果DownloadStringCompletedEventArgs
不是密封类,那么您可以创建一个新类并从中继承并向其添加额外的string Para
字段。