multithreading - Consuming a web service in multiple threads c# -


i consuming web service provided me vendor in c# application. application calls web method in loop , slows down performance. complete set of results, takes more hour.

can apply multi threading on side consume web service in multiple threads , combine results together?

is there better approach retrieve data in minutes instead of hours?

first of have make sure vendor does indeed support this or not prohibit (which probable too).

the code straightforward, using method such parallel.for

simple example (google.com):

parallel.for(0, norequests,                => {                   //code request goes here                } ); 

exaplanation:

in parallel.for loop, requests executed in-parallel (as implied in name), potentially provide significant increase in performance.

further reading:

msdn on parallel.for loops


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -