我有ObservableCollection
这样:
private string Username;
private string Password;
ObservableCollection<Employee> employees = new ObservableCollection<Employee>();
employees.Add(new Employee() { Username = "Bill54", Password = "sundayfunday"});
employees.Add(new Employee() { Username = "Sarah66", Password = "doglover"});
employees.Add(new Employee() { Username = "Nick42", Password = "gopatriots"});
return employees;
我希望每个项目都通过Parallel.ForEach
使用其字符串值执行此操作:
using (var client = new CookieAwareWebclient)
{
var values = new NameValueCollection();
values.Add("username", Username);
values.Add("login_password", Password);
var responseString = client.UploadValues(url, values);
}
我该怎么做?