Pick.Branches 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
PickBranch 对象的集合,Pick 活动可能会基于传入的事件执行其中的一个活动。
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)
属性值
分支集合。
示例
下面的代码示例演示如何设置 Pick 活动的 Branches 属性。 此示例摘自 使用选取活动 示例。
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;
}