Introduction to Thread
Multithreading is solution to parallel execution of code in C#. A thread is an independent execution path. Thread can run simultaneously with other threads. To use this Technic in C# you have to add namespaces call:
using System;
using System.Threading;
lets look at simple example:
class FirstThread
{
static void Main ()
{
Thread thisThread = new Thread (writeThread);
thisThread.start();
for (int i = 0; i<100; i++)
consol.write (“First”) ;
}static void writeThread ()
{
for (int i = 0; i<100; i++)
consol.write (“Thread”);
}}
Main thread will create new thread call writeThread, wile Simultaneously the main thread do its Job and print “First”.
Once you run the code, IsAlive property will set to true, and after thread finish a value will set false. Take note that once thread ended you can’t restart it.
u don’t seem to have a about page or a way of contacting u. Where in the world do u operate from?
Hi, Please refer to mylinkedin profile
my.linkedin.com/pub/mostafa-farahmand/41/4aa/987
thank you