in Technology by
What is Parallel.Invoke in C#?

1 Answer

0 votes
by

Suppose concurrently I want to do many tasks, like digging, cleaning, and so on. So this can be done using the Parallel.Invoke static method. This method will allow me to add various operations and execute them concurrently in parallel.

  1. private void OtherTask()  
  2. {  
  3.     //Some task  
  4. }  
  5.  private void Digging()  
  6. {  
  7.    //Some task  
  8. }  
  9.  private void CleanIt()  
  10. {  
  11.     //Some task  
  12. }  
  13.  public void CallAllTask()  
  14. {  
  15.     Parallel.Invoke(  
  16.       new Action(OtherTask)  
  17.       , new Action(Digging)  
  18.       , new Action(CleanIt));  

The code snippet above will execute all of the list of operations in parallel.

Related questions

0 votes
    I'm trying to PInvoke into this C++ library function: int Initialize(Callback* callback); struct Callback { ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    I'm trying to PInvoke into this C++ library function: int Initialize(Callback* callback); struct Callback { ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    What happens when we invoke a method on a nil pointer?...
asked Nov 10, 2020 in Technology by JackTerrance
0 votes
    I have a AWS API Gateway, deployed using SAM template. The API request comes to the Proxy Lambda Function ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I've got an extensive project. Amongst other things, it contains an UserForm Worksheet (Data) with a button ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    Which of these exceptions handles the situations when an illegal argument is used to invoke a method? (a) ... questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    When will the browser invoke the handler? (a) Program begins (b) Any event occurs (c) Specified ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 23, 2021 in Education by JackTerrance
0 votes
    What are the different ways to implement parallel processing in Informatica?...
asked Mar 27, 2021 in Technology by JackTerrance
0 votes
    What is parallel processing in Informatica?...
asked Mar 27, 2021 in Technology by JackTerrance
0 votes
    How can you run multiple Jobs in parallel within Talend?...
asked Mar 23, 2021 in Technology by JackTerrance
0 votes
    How to define the number of parallel processes while communicating to remote hosts? (i)become (ii)forks (iii)pipelining (iv)become_method...
asked Jan 25, 2023 in General by JackTerrance
0 votes
    So I have some code which copies files to 5 remote PCs on the network. I have a class which ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I have a function that has more than 1400+ crypto pairs and I have to send an API against each ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    Hi i'm using this to set a title attribute on elements: $('.upgradeTables thead tr td:gt(1)'). ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
...