Parallel.CompletionCondition 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在任何分支完成后计算。
public:
property System::Activities::Activity<bool> ^ CompletionCondition { System::Activities::Activity<bool> ^ get(); void set(System::Activities::Activity<bool> ^ value); };
[System.Windows.Markup.DependsOn("Variables")]
public System.Activities.Activity<bool> CompletionCondition { get; set; }
[<System.Windows.Markup.DependsOn("Variables")>]
member this.CompletionCondition : System.Activities.Activity<bool> with get, set
Public Property CompletionCondition As Activity(Of Boolean)
属性值
完成表达式。
- 属性
示例
下面的代码示例演示如何设置 Parallel 活动的 CompletionCondition 属性。
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.." },
}
},
注解
如果此属性的计算结果为 true
,则取消集合中的其他 Branches 计划元素。 如果未设置此属性,则 Activity 集合中的所有 Branches 对象都将执行,直至完成为止。