我正在尝试为 matchcollection 创建一个 Parallel.Foreach 循环。它在我建造的刮刀中。我只需要知道在 Parallel.Foreach 中放什么
MatchCollection m = Regex.Matches(htmlcon, matchlink, RegexOptions.Singleline);
Parallel.ForEach(WHAT DO I PUT HERE? =>
{
Get(match.Groups[1].Value, false);
Match fname = Regex.Match(htmlcon, @"<span class=""given-name"(.*?)</span>", RegexOptions.Singleline);
Match lname = Regex.Match(htmlcon, @"span class=""family-name"">(.*?)</span>", RegexOptions.Singleline);
firstname = fname.Groups[1].Value;
lastname = lname.Groups[1].Value;
sw.WriteLine(firstname + "," + lastname);
sw.Flush();
}):
我试过了:
Parallel.ForEach<MatchCollection>(m,match =>
但没有运气!
提前致谢!:)