Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Take a look at the <a href="http://msdn.microsoft.com/en-us/library/dd460717.aspx" rel="nofollow">Task Parallel Library (TPL)</a> which was introduced in .NET Framework 4 (ie. with Visual Studio 2010). More specifically, in terms of the TPL, your problem can be solved with <a href="http://msdn.microsoft.com/en-us/library/dd537609.aspx" rel="nofollow">task parallelism</a>.</p> <p>Now, I'm not an TPL expert myself at all, but documentation suggests that you should be able to do what you want with <a href="http://msdn.microsoft.com/en-us/library/system.threading.tasks.parallel.invoke.aspx" rel="nofollow"><code>Parallel.Invoke</code></a>:</p> <pre><code>using System.Threading.Tasks; … List&lt;wrecords&gt; records1 = null; List&lt;wrecords&gt; records2 = null; List&lt;wrecords&gt; records3 = null; // ^ Initialize these to any default value to prevent a compile-time error. // The compiler cannot know that below delegates will actually be called, // so without the initialization you would soon get a "use of unassigned // variable" error. Parallel.Invoke( () =&gt; { records1 = Search.GetrecordsofAAA(heart); }, () =&gt; { records2 = Search.GetrecordsofBBB(heart); }, () =&gt; { records3 = Search.GetrecordsofCCC(heart); } ); </code></pre> <p>P.S.: Once your methods execute in parallel, you need to make sure that none of them has any side effects that could result in the other methods not functioning properly. (For instance, if these methods read and modify the same static fields belonging to your <code>Search</code> class, that could lead to problems.)</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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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