rutledgj
asked on
Another Parallel programming question VB.NET
So with your help I now have this working
Dim w As New Work
Parallel.ForEach(LstVendor s, Sub(currentVendor)
'Dim w As New Work
w.DoWork(currentVendor)
End Sub)
What I really need now is a way to :
1 Use a queue to process,
2. Have a cancellation token available
3. Have a way to know when all tasks are completed.
Please only vb.net code. I can find csharp examples but have a very hard time converting them to vb.
Dim w As New Work
Parallel.ForEach(LstVendor
'Dim w As New Work
w.DoWork(currentVendor)
End Sub)
What I really need now is a way to :
1 Use a queue to process,
2. Have a cancellation token available
3. Have a way to know when all tasks are completed.
Please only vb.net code. I can find csharp examples but have a very hard time converting them to vb.
ASKER
I was looking more for a way to use the task.waitall method
ASKER
It appears that waitall requires a list of task to monitor which I don't see a way to do that using the foreach loop. Is there another way to do this not using foreach where the tasks can be saved to a collection?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok. So what I have is a class Vendor.
I have a LstVendor(of Vendor)
I have another class called Worker with a method called DoWork(v as Vendor)
I'm not sure how to substitute my items into your code where Object is.
I have a LstVendor(of Vendor)
I have another class called Worker with a method called DoWork(v as Vendor)
I'm not sure how to substitute my items into your code where Object is.
your class Worker is in this case replaced by the vendorsAction function. So I would just copy the DoWork method in there to the function.
http://msdn.microsoft.com/