ParallelLoopState::IsStopped Property
Gets whether any iteration of the loop has called the Stop method.
Assembly: mscorlib (in mscorlib.dll)
For long-running iterations of the loop, you can retrieve the value of the IsStopped property to determine whether any iterations of the loop that began execution before the call to the Stop method are still executing. You can then use the value of the IsStopped property to determine whether they should return immediately or execute normally.
The following example executes up to 10,000 iterations of a loop in parallel. Each iteration pauses for a random interval from 1 to 1,000 milliseconds. A randomly generated value determines on which iteration of the loop the Stop method is called. Because iterations of the loop are still likely to be executing when the Stop method is called, the lambda expression calls the IsStopped method to check whether another iteration has called the Stop method. If it returns true, the iteration returns immediately.
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1