here is sample code for starting multiple task
Task.Factory.StartNew(() =>
{
//foreach (KeyValuePair entry in dicLis
if i start 10 task using Task.Factory.StartNew() so how do i notify after when 10 task will be finish
You can use Task.WaitAll. This call will block current thread until all tasks are finished.
Side note: you seem to be using Task
, Parallel
and Thread.SpinWait
, which makes your code complex. I would spend a bit of time analysing if that complexity is really necessary.