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
Συνεργαστείτε μαζί μας στο GitHub
Μπορείτε να βρείτε την πηγή για αυτό το περιεχόμενο στο GitHub, όπου μπορείτε επίσης να δημιουργήσετε και να εξετάσετε ζητήματα και αιτήματα έλξης. Για περισσότερες πληροφορίες, ανατρέξτε στον οδηγό συνεργατών.