次の Parallel.ForEach ループからすぐに抜け出すにはどうすればよいですか...
Parallel.ForEach(
webnode.ChildNodes.OfType<XmlNode>(),
(node,loopState) =>
{
if(threadCommand!=null && threadCommand.CurrentSubIndicator.StopSignaled)
loopState.Stop();
string title = node.Attributes["Title"].Value;
string url = node.Attributes["Url"].Value;
if (!string.IsNullOrEmpty(specificItemUrl) &&
(!url.Equals(specificItemUrl)))
return;
Site partialSubSite = new WSS(site, Guid.Empty, title, url, "", null, null);
try
{
GetSite(partialSubSite, lite, readNavigation);
}
catch (Exception ex)
{
LogERError("Failed to fully read sub-site: {0}", url, ex);
partialSubSite.Guid = Constants.BadItemId;
}
});
if (threadCommand!=null && threadCommand.CurrentSubIndicator.StopSignaled)
条件を確認してtrueになったら、すべてのスレッドを終了して実行を停止したい
。これどうやってするの?