Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ParallelLoopState::IsStopped Property

.NET Framework (current version)
 

Gets whether any iteration of the loop has called the Stop method.

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

public:
property bool IsStopped {
	bool get();
}

Property Value

Type: System::Boolean

true if any iteration has stopped the loop by calling the Stop method; otherwise, false.

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.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft