Parallel 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 Parallel 活動的新執行個體。
public:
Parallel();
public Parallel ();
Public Sub New ()
範例
下列程式碼範例將示範如何建立 Parallel 活動。
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.." },
}
},