ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Implement MultiThreading using Task class in C#<p>Hi <a class="username" rel="Amit"> Amit</a>,</p> <p>Please refer below code.</p> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">List&lt;Task&gt; MyTaskList = new List&lt;Task&gt;(); for (int i = 0; i &lt; 10; i++) { var temp = i; MyTaskList.Add(Task.Factory.StartNew(() =&gt; Console.WriteLine(temp+1))); } Task.WaitAll(MyTaskList.ToArray());</pre> <p><span style="text-decoration: underline;"><strong>Output</strong></span></p> <p>1 2 3 4 5 6 7 8 9 10</p>https://www.aspforums.net:443/Threads/689725/Implement-MultiThreading-using-Task-class-in-C/https://www.aspforums.net:443/Threads/689725/Implement-MultiThreading-using-Task-class-in-C/Tue, 04 Sep 2018 00:40:46 GMT