Edit

Share via


Pick.Branches Property

Definition

The collection of PickBranch objects that the Pick activity potentially executes one of, based on incoming events.

public:
 property System::Collections::ObjectModel::Collection<System::Activities::Statements::PickBranch ^> ^ Branches { System::Collections::ObjectModel::Collection<System::Activities::Statements::PickBranch ^> ^ get(); };
public System.Collections.ObjectModel.Collection<System.Activities.Statements.PickBranch> Branches { get; }
member this.Branches : System.Collections.ObjectModel.Collection<System.Activities.Statements.PickBranch>
Public ReadOnly Property Branches As Collection(Of PickBranch)

Property Value

The branch collection.

Examples

The following code sample demonstrates setting the Branches property of a Pick activity. This example is from the Using the Pick Activity sample.

static Activity CreateWF()
{
    Variable<string> name = new Variable<string>();
    Sequence body = new Sequence
    {
        Variables = { name },
        Activities =
        {
            new WriteLine { Text = "What is your name? (You have 5 seconds to answer)" },
            new Pick
            {
               Branches =
               {
                   new PickBranch
                    {
                       Trigger = new ReadString
                       {
                           Result = name,
                           BookmarkName = bookmarkName
                       },
                       Action = new WriteLine
                       {
                           Text = new InArgument<string>(env => "Hello " + name.Get(env))
                       }
                   },
                   new PickBranch
                    {
                       Trigger = new Delay
                       {
                           Duration = TimeSpan.FromSeconds(5)
                       },
                       Action = new WriteLine
                       {
                           Text = "Time is up."
                       }
                   }
               }
           }
       }
    };

    return body;
}

Applies to