Parallel.CompletionCondition Property (System.Activities.Statements)

Switch View :
ScriptFree
.NET Framework Class Library
Parallel.CompletionCondition Property

Evaluates after any branch completes.

Namespace:  System.Activities.Statements
Assembly:  System.Activities (in System.Activities.dll)
Syntax

Visual Basic
Public Property CompletionCondition As Activity(Of Boolean)
	Get
	Set
C#
public Activity<bool> CompletionCondition { get; set; }
Visual C++
public:
property Activity<bool>^ CompletionCondition {
	Activity<bool>^ get ();
	void set (Activity<bool>^ value);
}
F#
member CompletionCondition : Activity<bool> with get, set

Property Value

Type: System.Activities.Activity<Boolean>
The completion expression.
Remarks

If this property evaluates to true, then the other scheduled elements in the Branches collection are canceled. If this property is not set, all Activity objects in the Branches collection execute until completion.

Examples

The following code sample demonstrates setting the CompletionCondition property of a Parallel activity. This example is from the Cancellation Handler on Compensable Activity sample.

C#

return new Parallel
{
    // Timeout from branch causes other branch to cancel.
    CompletionCondition = true,

    Branches =
    {
        // Delay Branch
        new Sequence
        {
            Activities =
            {
                new WriteLine { Text = "Branch1: Body is about to Delay 2secs transferring execution to Branch2" },
                new Delay
                {
                    Duration = TimeSpan.FromSeconds(2)
                },
                new WriteLine { Text = "Branch1: Body is about to complete causing Branch2 to cancel.." },
            }
        },


Version Information

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4
.NET Framework Security

Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also

Reference