Creating multiple threads in C#

The following is an example on how multiple threads can be created in csharp within a for loop. This demonstrates how a single function is invoked by multiple threads. static void doWork() { Console.WriteLine("Thread id of current thread is {0}", Thread.CurrentThread.ManagedThreadId); } ThreadStart Op = new ThreadStart(doWork);   for(int i = 0; i < 5; […]
Continue reading…

Enjoyed this post? Share it!

 
 

Creating a simple thread in C#

The System.Threading class contains all the necessary methods and properties needed to create and manage threads in csharp. The general method of creating a thread is as follows: 1. Create a static method with a void return type that can be used to perform all the work needed to be performed by the thread. 2. […]
Continue reading…

Enjoyed this post? Share it!