System.Threading.Tasks.ParallelLoopState.Break Method

Communicates that the System.Threading.Tasks.Parallel loop should cease execution at the system's earliest convenience of iterations beyond the current iteration.

Syntax

public void Break ()

Remarks

ParallelLoopState.Break may be used to communicate to the loop that no other iterations after the current iteration need be run. For example, if ParallelLoopState.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, ParallelLoopState.Break causes ParallelLoopState.LowestBreakIteration to be set to the current iteration's index if the current index is less than the current value of ParallelLoopState.LowestBreakIteration.

ParallelLoopState.Break is typically employed in search-based algorithms where an ordering is present in the data source.

Requirements

Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0