ParallelLoopState.Break Method
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Communicates that the Parallel loop should cease execution at the system's earliest convenience of iterations beyond the current iteration.
Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
| Exception | Condition |
|---|---|
| InvalidOperationException |
The Stop method was previously called. Break and Stop may not be used in combination by iterations of the same loop. |
Break may be used to communicate to the loop that no other iterations after the current iteration need be run. For example, if Break is called from the 100th iteration of a for loop iterating in parallel from 0 to 1000, all iterations less than 100 should still be run, but the iterations from 101 through to 1000 are not necessary.
For long-running iterations that may already be executing, Break causes LowestBreakIteration to be set to the current iteration's index if the current index is less than the current value of LowestBreakIteration.
Break is typically employed in search-based algorithms where an ordering is present in the data source.
Windows 8 Release Preview, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 SP2, Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.