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 物件會執行到完成為止。