Note that there are some explanatory texts on larger screens.

plurals
  1. POrunning tasks parallely in asp.net
    primarykey
    data
    text
    <p>By seeing this solution specified in <a href="https://stackoverflow.com/questions/9899649/divide-foreach-into-threads-sample">Divide Foreach into threads sample</a></p> <p>I tried to implement it with this code:</p> <pre><code>foreach (Object vo in arrreclist) { msg = String.Empty; objprocess.GetType().GetMethod("ProcessRecord").Invoke(objprocess, new Object[] { vo }); status = (StatusInfo)objprocess.GetType().GetProperty("status").GetValue(objprocess, null); if (status.errcode != 0) { lngfailedcnt++; WriteErrorLog(); } else { lngsuccesscnt++; lngInstanceSuccCount++; } lngcnt++; if ((lngcnt % 10) == 0) { if (instanceId == 0) { schldr.ModifyJobhistoryForUploadFileRecCnt(Runid, (int)lngTotreccnt, lngfailedcnt, (int)(lngfailedcnt + lngsuccesscnt)); } else { schldr.ModifyJobhistoryForUploadFileRecCnt(Runid, 0, lngfailedcnt, (int)(lngfailedcnt + lngsuccesscnt)); } status = schldr.status; if (status.errcode != 0) { if (!String.IsNullOrEmpty(Errorlogfile)) WriteErrorLog(); holdInstance = true; break; } //Get Job Status //If job was terminated then Update Batch and Job history with status as STOPPED intstatus = schedulersvc.GetJobStatus(Runid); status = schedulersvc.status; if (status.errcode != 0) { WriteErrorLog(); holdInstance = true; break; } if (intstatus == 1) //STOPPED { holdInstance = true; break; } lngcnt = 0; } } </code></pre> <p>And error message is coming for break statement:</p> <blockquote> <p>cannot leave the body of anonymous method or lambda expression</p> </blockquote> <p>My major task is to parallelize the following line:</p> <pre><code>objprocess.GetType().GetMethod("ProcessRecord").Invoke(objprocess, new Object[] { vo }) </code></pre> <p>But other are dependents so how to implement?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload