ParallelForEach<T> Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new instance of the ParallelForEach<T> class.
public:
ParallelForEach();
public ParallelForEach ();
Public Sub New ()
Examples
The following code sample demonstrates creating a ParallelForEach<T> activity. This example is from the Corporate Purchase Process sample.
// 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)
}
},
}
}
}
},
Applies to
Met ons samenwerken op GitHub
De bron voor deze inhoud vindt u op GitHub, waar u ook problemen en pull-aanvragen kunt maken en controleren. Bekijk onze gids voor inzenders voor meer informatie.