ParallelForEach<T>.Body 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
針對 ActivityAction 集合中包含的每個值執行一次的 Values。
public:
property System::Activities::ActivityAction<T> ^ Body { System::Activities::ActivityAction<T> ^ get(); void set(System::Activities::ActivityAction<T> ^ value); };
public System.Activities.ActivityAction<T> Body { get; set; }
member this.Body : System.Activities.ActivityAction<'T> with get, set
Public Property Body As ActivityAction(Of T)
屬性值
包含的活動動作。
範例
下列程式碼範例將示範如何設定 ParallelForEach<T> 活動的 Body 屬性。 此範例來自 公司購買程式 範例。
// invite all vendors and wait for their proposals
new ParallelForEach<Vendor>
{
DisplayName = "Get vendor proposals",
Values = new InArgument<IEnumerable<Vendor>>(ctx =>this.Rfp.Get(ctx).InvitedVendors),
Body = new ActivityAction<Vendor>()
{
Argument = iterationVariableVendor,
Handler = new Sequence
{
Variables = { tmpValue },
Activities =
{
// waits for a vendor proposal (creates a bookmark for a vendor)
new WaitForVendorProposal
{
VendorId = new LambdaValue<int>(ctx =>iterationVariableVendor.Get(ctx).Id) ,
Result = new OutArgument<double>(tmpValue)
},
// after the vendor proposal is received, it is registered in the Request for Proposals
new InvokeMethod
{
TargetObject = new InArgument<RequestForProposal>(ctx =>this.Rfp.Get(ctx)),
MethodName = "RegisterProposal",
Parameters =
{
new InArgument<Vendor>(iterationVariableVendor),
new InArgument<double>(tmpValue)
}
},
}
}
}
},