views:

15

answers:

1

I have a foreach loop that processes a few thousand xmlnodes from an xmlnodelist. I'm trying to integrate the Parallel.For options from .net 4 but I get an error that "No overload for method 'For' takes 3 arguments'. But every example I see so far has it written this way. Does someone know what I need to change to get this to compile? Thanks.

Parallel.For( 0, jobs.Count, i => { //..do work here.. });

+1  A: 

Now the only other question I have is how do I break out of the current iteration? It doesn't seem to like my continue statements.

How exactly do you expect continue statements to work when each iteration can be running concurrently? You should read How to: Stop or Break from a Parallel.For Loop on the MSDN for more information about this and take a look at the Stop and Break methods.

Rich

related questions