Redigera

Dela via


Parallel.Branches Property

Definition

The child elements to be executed in parallel.

public:
 property System::Collections::ObjectModel::Collection<System::Activities::Activity ^> ^ Branches { System::Collections::ObjectModel::Collection<System::Activities::Activity ^> ^ get(); };
[System.Windows.Markup.DependsOn("CompletionCondition")]
public System.Collections.ObjectModel.Collection<System.Activities.Activity> Branches { get; }
[<System.Windows.Markup.DependsOn("CompletionCondition")>]
member this.Branches : System.Collections.ObjectModel.Collection<System.Activities.Activity>
Public ReadOnly Property Branches As Collection(Of Activity)

Property Value

The elements.

Attributes

Examples

The following code sample demonstrates setting the Branches property of a Parallel activity.

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.." },
            }
        },

Applies to